Versions in this module Expand all Collapse all v1 v1.11.2 Nov 18, 2026 Changes in this version + const DefaultMemoryCacheSweepInterval + const DefaultSweepInterval + func NewLRUCache[V any](data V, cacheDuration time.Duration) *lruCache[V] + func NewMemoryCache(data interface{}, cacheDuration time.Duration) *memoryCache + type Cache interface + Delete func(key K) + Get func(key K) (value interface{}, found bool) + Put func(key K, value interface{}, expiration time.Duration) + type EvictionReason string + const EvictCapacity + const EvictDelete + const EvictPurge + const EvictReplace + const EvictTTL + type LRUCache interface + Delete func(key K) + Get func(key K) (value V, found bool) + Put func(key K, value V, expiration time.Duration) + type LRUStore struct + OnEvict func(key K, value V, reason EvictionReason) + func NewLRUStore[K comparable, V any](ctx context.Context, opts Options[K, V]) (*LRUStore[K, V], error) + func (l *LRUStore[K, V]) CurrentBytes() int64 + func (l *LRUStore[K, V]) Delete(key K) + func (l *LRUStore[K, V]) Get(key K) (value V, found bool) + func (l *LRUStore[K, V]) Purge() + func (l *LRUStore[K, V]) Put(key K, value V, cacheDuration time.Duration) + type MemoryCacheStore struct + func NewMemoryCacheStore[K comparable](ctx context.Context) *MemoryCacheStore[K] + func (m *MemoryCacheStore[K]) Delete(key K) + func (m *MemoryCacheStore[K]) Get(key K) (value interface{}, found bool) + func (m *MemoryCacheStore[K]) Put(key K, value interface{}, cacheDuration time.Duration) + type Options struct + MaxBytes int64 + MaxSize int + OnEvict func(key K, value V, reason EvictionReason) + SizeOf func(key K, value V) int64 + SweepInterval time.Duration