Versions in this module Expand all Collapse all v0 v0.8.1 Apr 4, 2026 v0.8.0 Mar 28, 2026 v0.7.0 Mar 26, 2026 v0.6.5 Feb 9, 2026 Changes in this version + func CompressionRatio(original, compressed []byte) float64 + func ShouldCompress(data []byte) bool + type CacheAsideStrategy struct + func (s *CacheAsideStrategy) Clear(ctx context.Context, pattern string) error + func (s *CacheAsideStrategy) Delete(ctx context.Context, key string) error + func (s *CacheAsideStrategy) Get(ctx context.Context, key string) (interface{}, error) + func (s *CacheAsideStrategy) GetMulti(ctx context.Context, keys []string) (map[string]interface{}, error) + func (s *CacheAsideStrategy) Set(ctx context.Context, key string, value interface{}, ttl time.Duration) error + func (s *CacheAsideStrategy) SetMulti(ctx context.Context, items map[string]interface{}, ttl time.Duration) error + type CacheConfig struct + ClusterMode bool + Compression bool + DefaultTTL time.Duration + DialTimeout time.Duration + KeyPrefix string + MaxConnAge time.Duration + MaxRetries int + MinIdleConns int + PoolSize int + ReadTimeout time.Duration + RedisAddr []string + RedisDB int + RedisPassword string + WriteTimeout time.Duration + type CacheItem struct + CreatedAt time.Time + Key string + TTL time.Duration + Tags []string + UpdatedAt time.Time + Value interface{} + Version int + type CacheMetrics struct + type CacheStats struct + HitRate float64 + LocalHits int64 + LocalMisses int64 + LocalSize int64 + RedisHits int64 + RedisMisses int64 + Timestamp time.Time + type CacheStrategy interface + Clear func(ctx context.Context, pattern string) error + Delete func(ctx context.Context, key string) error + Get func(ctx context.Context, key string) (interface{}, error) + GetMulti func(ctx context.Context, keys []string) (map[string]interface{}, error) + Set func(ctx context.Context, key string, value interface{}, ttl time.Duration) error + SetMulti func(ctx context.Context, items map[string]interface{}, ttl time.Duration) error + type CacheableQuery struct + func (cq *CacheableQuery) Execute(ctx context.Context) (interface{}, error) + func (cq *CacheableQuery) Invalidate(ctx context.Context) error + func (cq *CacheableQuery) WithExecutor(executor func() (interface{}, error)) *CacheableQuery + func (cq *CacheableQuery) WithTTL(ttl time.Duration) *CacheableQuery + type CachedSearchResults struct + CachedAt time.Time + Query string + Results []interface{} + TotalCount int + type CachedSession struct + CachedAt time.Time + Data map[string]interface{} + ExpiresAt time.Time + ID string + UserID int + type CachedTicket struct + CachedAt time.Time + CustomerID string + ID int64 + OwnerID int + PriorityID int + QueueID int + StateID int + TicketNumber string + Title string + type CachedUser struct + CachedAt time.Time + Email string + GroupIDs []int + ID int + Login string + Name string + RoleIDs []int + type DataLoader interface + Load func(ctx context.Context, key string) (interface{}, error) + LoadMulti func(ctx context.Context, keys []string) (map[string]interface{}, error) + type LocalCache struct + func NewLocalCache(config *LocalCacheConfig) *LocalCache + func (lc *LocalCache) Clear() + func (lc *LocalCache) Delete(key string) + func (lc *LocalCache) Get(key string) (interface{}, bool) + func (lc *LocalCache) GetStats() *LocalCacheStats + func (lc *LocalCache) Set(key string, value interface{}, ttl time.Duration) + func (lc *LocalCache) Stop() + type LocalCacheConfig struct + CleanupInterval time.Duration + DefaultTTL time.Duration + MaxSize int + type LocalCacheItem struct + AccessedAt time.Time + CreatedAt time.Time + ExpiresAt time.Time + Size int64 + Value interface{} + type LocalCacheStats struct + Deletes int64 + Evictions int64 + Hits int64 + Misses int64 + Sets int64 + Size int64 + type Manager struct + func NewManager(config *ManagerConfig) (*Manager, error) + func (m *Manager) GetMultiTickets(ctx context.Context, ticketIDs []int64) (map[int64]*CachedTicket, error) + func (m *Manager) GetQueueTickets(ctx context.Context, queueID int, page, limit int) ([]*CachedTicket, error) + func (m *Manager) GetSearchResults(ctx context.Context, query string, filters map[string]interface{}) (*CachedSearchResults, error) + func (m *Manager) GetSession(ctx context.Context, sessionID string) (*CachedSession, error) + func (m *Manager) GetStats() *CacheStats + func (m *Manager) GetStrategy(name string) CacheStrategy + func (m *Manager) GetTicket(ctx context.Context, ticketID int64) (*CachedTicket, error) + func (m *Manager) GetUser(ctx context.Context, userID int) (*CachedUser, error) + func (m *Manager) InvalidateAll(ctx context.Context) error + func (m *Manager) InvalidatePattern(ctx context.Context, pattern string) error + func (m *Manager) InvalidateTicket(ctx context.Context, ticketID int64) error + func (m *Manager) SetQueueTickets(ctx context.Context, queueID int, page, limit int, tickets []*CachedTicket) error + func (m *Manager) SetSearchResults(ctx context.Context, query string, filters map[string]interface{}, ...) error + func (m *Manager) SetSession(ctx context.Context, session *CachedSession) error + func (m *Manager) SetTicket(ctx context.Context, ticket *CachedTicket) error + func (m *Manager) SetUser(ctx context.Context, user *CachedUser) error + func (m *Manager) WarmCache(ctx context.Context) error + type ManagerConfig struct + DefaultStrategy string + EnableLocal bool + EnableRedis bool + LocalConfig *LocalCacheConfig + RedisConfig *CacheConfig + WarmOnStartup bool + WarmupFunctions map[string]WarmupFunc + type QueryCache struct + func NewQueryCache(config *QueryCacheConfig) *QueryCache + func (qc *QueryCache) Get(ctx context.Context, query string, args ...interface{}) (*QueryResult, error) + func (qc *QueryCache) GetOrSet(ctx context.Context, query string, args []interface{}, ...) (interface{}, error) + func (qc *QueryCache) GetStats(ctx context.Context) (map[string]interface{}, error) + func (qc *QueryCache) InvalidateAll(ctx context.Context) error + func (qc *QueryCache) InvalidateTable(ctx context.Context, table string) error + func (qc *QueryCache) NewCacheableQuery(query string, args []interface{}) *CacheableQuery + func (qc *QueryCache) Set(ctx context.Context, query string, result interface{}, args ...interface{}) error + func (qc *QueryCache) WarmUp(ctx context.Context, queries []WarmUpQuery) error + type QueryCacheConfig struct + DefaultTTL time.Duration + RedisCache *RedisCache + type QueryResult struct + Args []interface{} + CachedAt time.Time + Count int + ExpiresAt time.Time + Query string + Result interface{} + type ReadThroughStrategy struct + func (s *ReadThroughStrategy) Clear(ctx context.Context, pattern string) error + func (s *ReadThroughStrategy) Delete(ctx context.Context, key string) error + func (s *ReadThroughStrategy) Get(ctx context.Context, key string) (interface{}, error) + func (s *ReadThroughStrategy) GetMulti(ctx context.Context, keys []string) (map[string]interface{}, error) + func (s *ReadThroughStrategy) Set(ctx context.Context, key string, value interface{}, ttl time.Duration) error + func (s *ReadThroughStrategy) SetMulti(ctx context.Context, items map[string]interface{}, ttl time.Duration) error + type RedisCache struct + func NewRedisCache(config *CacheConfig) (*RedisCache, error) + func (rc *RedisCache) Clear(ctx context.Context, pattern string) error + func (rc *RedisCache) Close() error + func (rc *RedisCache) Delete(ctx context.Context, key string) error + func (rc *RedisCache) Exists(ctx context.Context, key string) (bool, error) + func (rc *RedisCache) Expire(ctx context.Context, key string, ttl time.Duration) error + func (rc *RedisCache) Get(ctx context.Context, key string) (interface{}, error) + func (rc *RedisCache) GetMulti(ctx context.Context, keys []string) (map[string]interface{}, error) + func (rc *RedisCache) GetObject(ctx context.Context, key string, dest interface{}) error + func (rc *RedisCache) Info(ctx context.Context) (map[string]interface{}, error) + func (rc *RedisCache) Invalidate(ctx context.Context, pattern string) error + func (rc *RedisCache) Pipeline(ctx context.Context, fn func(pipe redis.Pipeliner) error) error + func (rc *RedisCache) Set(ctx context.Context, key string, value interface{}, ttl time.Duration) error + func (rc *RedisCache) SetMulti(ctx context.Context, items map[string]interface{}, ttl time.Duration) error + func (rc *RedisCache) SetObject(ctx context.Context, key string, value interface{}, ttl time.Duration) error + func (rc *RedisCache) TTL(ctx context.Context, key string) (time.Duration, error) + type WarmUpQuery struct + Args []interface{} + Executor func() (interface{}, error) + Query string + type WarmupFunc func(ctx context.Context, cache *Manager) error + type WriteBehindStrategy struct + func (s *WriteBehindStrategy) Clear(ctx context.Context, pattern string) error + func (s *WriteBehindStrategy) Delete(ctx context.Context, key string) error + func (s *WriteBehindStrategy) Get(ctx context.Context, key string) (interface{}, error) + func (s *WriteBehindStrategy) GetMulti(ctx context.Context, keys []string) (map[string]interface{}, error) + func (s *WriteBehindStrategy) Set(ctx context.Context, key string, value interface{}, ttl time.Duration) error + func (s *WriteBehindStrategy) SetMulti(ctx context.Context, items map[string]interface{}, ttl time.Duration) error + func (s *WriteBehindStrategy) Start(ctx context.Context) + type WriteThroughStrategy struct + func (s *WriteThroughStrategy) Clear(ctx context.Context, pattern string) error + func (s *WriteThroughStrategy) Delete(ctx context.Context, key string) error + func (s *WriteThroughStrategy) Get(ctx context.Context, key string) (interface{}, error) + func (s *WriteThroughStrategy) GetMulti(ctx context.Context, keys []string) (map[string]interface{}, error) + func (s *WriteThroughStrategy) Set(ctx context.Context, key string, value interface{}, ttl time.Duration) error + func (s *WriteThroughStrategy) SetMulti(ctx context.Context, items map[string]interface{}, ttl time.Duration) error