Versions in this module Expand all Collapse all v1 v1.0.0 Oct 31, 2023 Changes in this version + var DefaultMemStoreConfig = &MemStoreConfig + var ErrCacheNotFound = errors.New("cache not found") + type Config struct + Debug bool + Logger util.LoggerInterface + TTL int64 + type DataStorage interface + BatchDeleteKeys func(ctx context.Context, keys []string) error + BatchGetValues func(ctx context.Context, keys []string) ([]string, error) + BatchKeyExist func(ctx context.Context, keys []string) (bool, error) + BatchSetKeys func(ctx context.Context, kvs []util.Kv) error + CleanCache func(ctx context.Context) error + DeleteKey func(ctx context.Context, key string) error + DeleteKeysWithPrefix func(ctx context.Context, keyPrefix string) error + GetValue func(ctx context.Context, key string) (string, error) + Init func(config *Config) error + KeyExists func(ctx context.Context, key string) (bool, error) + SetKey func(ctx context.Context, kv util.Kv) error + type Gcache struct + func NewGcache(builder *gcache.CacheBuilder) *Gcache + func (g *Gcache) BatchDeleteKeys(ctx context.Context, keys []string) error + func (g *Gcache) BatchGetValues(ctx context.Context, keys []string) ([]string, error) + func (g *Gcache) BatchKeyExist(ctx context.Context, keys []string) (bool, error) + func (g *Gcache) BatchSetKeys(ctx context.Context, kvs []util.Kv) error + func (g *Gcache) CleanCache(ctx context.Context) error + func (g *Gcache) DeleteKey(ctx context.Context, key string) error + func (g *Gcache) DeleteKeysWithPrefix(ctx context.Context, keyPrefix string) error + func (g *Gcache) GetValue(ctx context.Context, key string) (string, error) + func (g *Gcache) Init(config *Config) error + func (g *Gcache) KeyExists(ctx context.Context, key string) (bool, error) + func (g *Gcache) SetKey(ctx context.Context, kv util.Kv) error + type MemStoreConfig struct + MaxSize int64 + type Memory struct + func NewMem(config ...*MemStoreConfig) *Memory + func (m *Memory) BatchDeleteKeys(ctx context.Context, keys []string) error + func (m *Memory) BatchGetValues(ctx context.Context, keys []string) ([]string, error) + func (m *Memory) BatchKeyExist(ctx context.Context, keys []string) (bool, error) + func (m *Memory) BatchSetKeys(ctx context.Context, kvs []util.Kv) error + func (m *Memory) CleanCache(ctx context.Context) error + func (m *Memory) DeleteKey(ctx context.Context, key string) error + func (m *Memory) DeleteKeysWithPrefix(ctx context.Context, keyPrefix string) error + func (m *Memory) GetValue(ctx context.Context, key string) (string, error) + func (m *Memory) Init(conf *Config) error + func (m *Memory) KeyExists(ctx context.Context, key string) (bool, error) + func (m *Memory) SetKey(ctx context.Context, kv util.Kv) error + type Redis struct + func NewRedis(config ...*RedisStoreConfig) *Redis + func (r *Redis) BatchDeleteKeys(ctx context.Context, keys []string) error + func (r *Redis) BatchGetValues(ctx context.Context, keys []string) ([]string, error) + func (r *Redis) BatchKeyExist(ctx context.Context, keys []string) (bool, error) + func (r *Redis) BatchSetKeys(ctx context.Context, kvs []util.Kv) error + func (r *Redis) CleanCache(ctx context.Context) error + func (r *Redis) DeleteKey(ctx context.Context, key string) error + func (r *Redis) DeleteKeysWithPrefix(ctx context.Context, keyPrefix string) error + func (r *Redis) GetValue(ctx context.Context, key string) (data string, err error) + func (r *Redis) Init(conf *Config) error + func (r *Redis) KeyExists(ctx context.Context, key string) (bool, error) + func (r *Redis) SetKey(ctx context.Context, kv util.Kv) error + type RedisStoreConfig struct + Client redis.UniversalClient + KeyPrefix string + Options *redis.UniversalOptions