Versions in this module Expand all Collapse all v0 v0.0.1 May 17, 2022 Changes in this version + func AddCleanTask(task func() error, keys ...string) + func TotalWeights(c []NodeConf) int + type Cache interface + Del func(keys ...string) error + DelCtx func(ctx context.Context, keys ...string) error + Get func(key string, val interface{}) error + GetCtx func(ctx context.Context, key string, val interface{}) error + IsNotFound func(err error) bool + Set func(key string, val interface{}) error + SetCtx func(ctx context.Context, key string, val interface{}) error + SetWithExpire func(key string, val interface{}, expire time.Duration) error + SetWithExpireCtx func(ctx context.Context, key string, val interface{}, expire time.Duration) error + Take func(val interface{}, key string, query func(val interface{}) error) error + TakeCtx func(ctx context.Context, val interface{}, key string, ...) error + TakeWithExpire func(val interface{}, key string, ...) error + TakeWithExpireCtx func(ctx context.Context, val interface{}, key string, ...) error + func New(c ClusterConf, barrier syncx.SingleFlight, st *Stat, errNotFound error, ...) Cache + func NewNode(rds *redis.Redis, barrier syncx.SingleFlight, st *Stat, errNotFound error, ...) Cache + type CacheConf = ClusterConf + type ClusterConf []NodeConf + type NodeConf struct + Weight int + type Option func(o *Options) + func WithExpiry(expiry time.Duration) Option + func WithNotFoundExpiry(expiry time.Duration) Option + type Options struct + Expiry time.Duration + NotFoundExpiry time.Duration + type Stat struct + DbFails uint64 + Hit uint64 + Miss uint64 + Total uint64 + func NewStat(name string) *Stat + func (s *Stat) IncrementDbFails() + func (s *Stat) IncrementHit() + func (s *Stat) IncrementMiss() + func (s *Stat) IncrementTotal()