redis

package
v1.0.1005 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 20, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Addr     string
	Password string
	DB       int

	MinIdleConn  int
	DialTimeout  time.Duration
	ReadTimeout  time.Duration
	WriteTimeout time.Duration
	PoolSize     int
	PoolTimeout  time.Duration

	EnableTrace bool

	Logger iLogger
}

缓存配置

type Redis

type Redis struct {
	// contains filtered or unexported fields
}

*

  • redis 缓存 *
  • @create 2021-7-15
  • @author deatil

func New

func New(config Config) *Redis

构造函数

func (*Redis) Close

func (this *Redis) Close() error

关闭

func (*Redis) Decrement

func (this *Redis) Decrement(key string, value ...int64) error

减少

func (*Redis) Exists

func (this *Redis) Exists(key string) bool

判断是否存在

func (*Redis) Expire

func (this *Redis) Expire(key string, expiration time.Duration) error

过期时间

func (*Redis) Flush

func (this *Redis) Flush() (bool, error)

清空

func (*Redis) Forever

func (this *Redis) Forever(key string, value any) error

存在永久

func (*Redis) Forget

func (this *Redis) Forget(key string) (bool, error)

删除

func (*Redis) Get

func (this *Redis) Get(key string) (any, error)

获取

func (*Redis) GetClient

func (this *Redis) GetClient() *redis.Client

获取客户端

func (*Redis) HashDel

func (this *Redis) HashDel(key string) error

HashDel

func (*Redis) HashGet

func (this *Redis) HashGet(key string, field string) (string, error)

HashGet

func (*Redis) HashSet

func (this *Redis) HashSet(key string, field string, value string) error

HashSet

func (*Redis) Increment

func (this *Redis) Increment(key string, value ...int64) error

增加

func (*Redis) Put

func (this *Redis) Put(key string, value any, ttl time.Duration) error

设置

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL