Documentation ¶
Index ¶
- func NotFound(err error) bool
- type Hook
- func (h *Hook) AfterProcess(ctx context.Context, cmd redis.Cmder) error
- func (h *Hook) AfterProcessPipeline(ctx context.Context, cmds []redis.Cmder) error
- func (h *Hook) BeforeProcess(ctx context.Context, cmd redis.Cmder) (context.Context, error)
- func (h *Hook) BeforeProcessPipeline(ctx context.Context, cmds []redis.Cmder) (context.Context, error)
- type IRedisSet
- type Option
- type Options
- type RedisClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type IRedisSet ¶
type IRedisSet interface {
Get(name string) RedisClient
}
type Option ¶
type Option struct { Enable bool `default:"true" desc:"是否启用"` Name string `default:"master" desc:"redis key前缀,不能重复"` ReadOnly bool `default:"false" desc:"read only"` Addr string `default:"127.0.0.1:6379" desc:"redis地址"` DB int `default:"0" desc:"redis数据库"` Username string `default:"" desc:"redis用户名"` Password string `default:"" desc:"redis密码"` PoolSize int `default:"64" desc:"poolSize * runtime.GOMAXPROCS"` PingInternal int `default:"30" desc:"ping间隔"` }
type RedisClient ¶
type RedisClient interface { Ping(ctx context.Context) error DBSize(ctx context.Context) (int64, error) SetNX(ctx context.Context, key string, value string, expiration time.Duration) (bool, error) Get(ctx context.Context, key string) (string, error) Set(ctx context.Context, key string, value string, expiration time.Duration) error Del(ctx context.Context, key string) (int64, error) Expire(ctx context.Context, key string, duration time.Duration) (bool, error) Exists(ctx context.Context, key string) (int64, error) HSet(ctx context.Context, key string, field string, value string) error HGet(ctx context.Context, key string, field string) (string, error) HGetAll(ctx context.Context, key string) (map[string]string, error) HMGets(ctx context.Context, key string, fields ...string) ([]interface{}, error) HMSet(ctx context.Context, key string, fields map[string]interface{}) error HExists(ctx context.Context, key string, field string) (bool, error) HKeys(ctx context.Context, key string) ([]string, error) HVals(ctx context.Context, key string) ([]string, error) HIncrBy(ctx context.Context, key string, field string, value int64) (int64, error) HIncrByFloat(ctx context.Context, key string, field string, value float64) (float64, error) HSetNX(ctx context.Context, key string, field string, value string) (bool, error) Info(ctx context.Context, section string) (string, error) SetPrefix(prefix string) RedisClient // 设置key前缀; 不要重复设置 SetSep(sep string) RedisClient // 设置分隔符 默认":" }
func GetRedisInstance ¶
func GetRedisInstance(name string) RedisClient
func NewRedisClient ¶
func NewRedisClient(opt *redis.Options) RedisClient
Click to show internal directories.
Click to hide internal directories.