Versions in this module Expand all Collapse all v1 v1.24.5 Aug 14, 2025 Changes in this version + const SlowCacheThreshold + func GetInt64(key string, getFunc func() (int64, error)) (int64, error) + func GetString(key string, getFunc func() (string, error)) (string, error) + func GetWithContextCache[T, K any](ctx context.Context, groupKey string, targetKey K, ...) (T, error) + func GetWithEphemeralCache[T, K any](ctx context.Context, c *EphemeralCache, groupKey string, targetKey K, ...) (T, error) + func Init() error + func Remove(key string) + func Test() (time.Duration, error) + func WithCacheContext(ctx context.Context) context.Context + type EphemeralCache struct + func GetContextCache(ctx context.Context) *EphemeralCache + func NewEphemeralCache(checkLifeTime ...time.Duration) *EphemeralCache + func (cc *EphemeralCache) Delete(tp, key any) + func (cc *EphemeralCache) Get(tp, key any) (any, bool) + func (cc *EphemeralCache) Put(tp, key, value any) + type GetJSONError struct + func (e *GetJSONError) ToError() error + type MemoryItem struct + Created int64 + Timeout int64 + Val any + type RedisCacher struct + func (c *RedisCacher) Decr(key string) error + func (c *RedisCacher) Delete(key string) error + func (c *RedisCacher) Flush() error + func (c *RedisCacher) Get(key string) any + func (c *RedisCacher) Incr(key string) error + func (c *RedisCacher) IsExist(key string) bool + func (c *RedisCacher) Ping() error + func (c *RedisCacher) Put(key string, val any, expire int64) error + func (c *RedisCacher) StartAndGC(opts cache.Options) error + type StringCache interface + ChiCache func() chi_cache.Cache + Delete func(key string) error + Get func(key string) (string, bool) + GetJSON func(key string, ptr any) (exist bool, err *GetJSONError) + IsExist func(key string) bool + Ping func() error + Put func(key, value string, ttl int64) error + PutJSON func(key string, v any, ttl int64) error + func GetCache() StringCache + func NewStringCache(cacheConfig setting.Cache) (StringCache, error) + type TwoQueueCache struct + func (c *TwoQueueCache) Decr(key string) error + func (c *TwoQueueCache) Delete(key string) error + func (c *TwoQueueCache) Flush() error + func (c *TwoQueueCache) Get(key string) any + func (c *TwoQueueCache) Incr(key string) error + func (c *TwoQueueCache) IsExist(key string) bool + func (c *TwoQueueCache) Ping() error + func (c *TwoQueueCache) Put(key string, val any, timeout int64) error + func (c *TwoQueueCache) StartAndGC(opts mc.Options) error + type TwoQueueCacheConfig struct + GhostRatio float64 + RecentRatio float64 + Size int