Documentation ¶
Index ¶
- func Connect(addr string, options ...Option)
- func Del(ctx context.Context, key string) (err error)
- func Get[T RedisValueTypes](ctx context.Context, key string) (val T, isNotExist bool, err error)
- func GetKeyEventExpired(db int) string
- func HashDel(ctx context.Context, key string, val string) (err error)
- func HashGetAll(ctx context.Context, key string) (result map[string]string, isNotExist bool, err error)
- func HashGetString(ctx context.Context, key, field string) (result string, isNotExist bool, err error)
- func HashSet(ctx context.Context, key string, val map[string]any, expiration time.Duration) (err error)
- func HashUpdate(ctx context.Context, key string, val ...any) (err error)
- func IsRedisNilErr(err error) bool
- func SetEx(ctx context.Context, key string, val any, exp time.Duration) (err error)
- func Subscribe(ctx context.Context, key string) (subscribe *redis.PubSub)
- type Option
- type Options
- type RedisValueTypes
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetKeyEventExpired ¶
GetKeyEventExpired 需要修改redis.conf配置项,启用notify-keyspace-events = "EX"
func HashGetAll ¶
func HashGetAll(ctx context.Context, key string) (result map[string]string, isNotExist bool, err error)
HashGetAll 获取Hash的所有字段和值
func HashGetString ¶
func HashGetString(ctx context.Context, key, field string) (result string, isNotExist bool, err error)
HashGetString 获取Hash字段的值
func HashSet ¶
func HashSet(ctx context.Context, key string, val map[string]any, expiration time.Duration) (err error)
HashSet 设置Hash
func HashUpdate ¶
HashUpdate 更新Hash字段
func IsRedisNilErr ¶ added in v0.10.0
IsRedisNilErr 判断是否为redis.Nil
Types ¶
type Option ¶
type Option func(*Options)
func WithUserAndPass ¶ added in v0.11.0
WithUserAndPass 设置用户名和密码
Click to show internal directories.
Click to hide internal directories.