Versions in this module Expand all Collapse all v0 v0.1.1 Jul 22, 2022 v0.1.0 Jul 22, 2022 Changes in this version + var DefaultClient Cache + var DefaultExpireTime = time.Hour * 24 + var DefaultNotFoundExpireTime = time.Minute + var ErrPlaceholder = errors.New("cache: placeholder") + var ErrSetMemoryWithNotFound = errors.New("cache: set memory cache err for not found") + var NotFoundPlaceholder = "*" + func BuildCacheKey(keyPrefix string, key string) (cacheKey string, err error) + func Del(ctx context.Context, keys ...string) error + func Get(ctx context.Context, key string, val interface{}) error + func MultiGet(ctx context.Context, keys []string, valueMap interface{}) error + func MultiSet(ctx context.Context, valMap map[string]interface{}, expiration time.Duration) error + func Set(ctx context.Context, key string, val interface{}, expiration time.Duration) error + func SetCacheWithNotFound(ctx context.Context, key string) error + type Cache interface + Del func(ctx context.Context, keys ...string) error + Get func(ctx context.Context, key string, val interface{}) error + MultiGet func(ctx context.Context, keys []string, valueMap interface{}) error + MultiSet func(ctx context.Context, valMap map[string]interface{}, expiration time.Duration) error + Set func(ctx context.Context, key string, val interface{}, expiration time.Duration) error + SetCacheWithNotFound func(ctx context.Context, key string) error + func NewMemoryCache(keyPrefix string, encoding encoding.Encoding) Cache + func NewRedisCache(client *redis.Client, keyPrefix string, encoding encoding.Encoding, ...) Cache + type GetFunc func(key string) interface + func (f GetFunc) Get(key string) interface{} + type Getter interface + Get func(key string) interface{}