Documentation
¶
Index ¶
Constants ¶
View Source
const ( CacherDriverRedis = "redis" CacherDriverRedisCluster = "miniredis" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ICacher ¶
type ICacher interface {
IIntCacher
}
ICacher 缓存
func NewRedisCacher ¶ added in v1.0.2
func NewRedisCacher(cli *redis.Client) ICacher
NewRedisCacher creates a new redis cacher
func NewRedisCacherByMiniRedis ¶ added in v1.2.22
func NewRedisCacherByMiniRedis(cli *miniredis.Miniredis) ICacher
NewRedisCacherByMiniRedis creates a new redis cacher by mini redis
type ICloser ¶ added in v1.0.2
type ICloser interface {
Close() error
Client() *redis.Client
}
ICloser 关闭缓存
type IIntCacher ¶ added in v1.0.2
type IIntCacher interface {
ICloser
// IncMax 增加缓存值,如果超过max则返回max
IncMax(ctx context.Context, key string, max int64, expiration time.Duration) (bool, error)
// DecMin 减少缓存值,如果小于min则返回min
DecMin(ctx context.Context, key string, min int64, expiration time.Duration) (bool, error)
}
IIntCacher 整数缓存
Click to show internal directories.
Click to hide internal directories.