Versions in this module Expand all Collapse all v0 v0.1.22 Jul 26, 2024 Changes in this version + type Cache interface + Get func(key interface{}) (value interface{}, ok bool) + Remove func(key interface{}) + RemoveAll func() + Set func(key interface{}, value interface{}) + Stats func() Stats + type EvictionCallback func(key, value interface{}) + type ExpiringCache interface + EvictExpired func() + SetWithExpiration func(key interface{}, value interface{}, expiration time.Duration) + func NewLRU(defaultExpiration time.Duration, evictionInterval time.Duration, ...) ExpiringCache + func NewTTL(defaultExpiration time.Duration, evictionInterval time.Duration) ExpiringCache + func NewTTLWithCallback(defaultExpiration time.Duration, evictionInterval time.Duration, ...) ExpiringCache + type Item struct + Key string + Value Value + type LRUCache struct + func NewLRUCache(capacity int64) *LRUCache + func (lru *LRUCache) Capacity() int64 + func (lru *LRUCache) Clear() + func (lru *LRUCache) Delete(key string) bool + func (lru *LRUCache) Evictions() int64 + func (lru *LRUCache) Get(key string) (v Value, ok bool) + func (lru *LRUCache) Items() []Item + func (lru *LRUCache) Keys() []string + func (lru *LRUCache) Length() int64 + func (lru *LRUCache) Oldest() (oldest time.Time) + func (lru *LRUCache) Peek(key string) (v Value, ok bool) + func (lru *LRUCache) Set(key string, value Value) + func (lru *LRUCache) SetCapacity(capacity int64) + func (lru *LRUCache) SetIfAbsent(key string, value Value) + func (lru *LRUCache) Size() int64 + func (lru *LRUCache) Stats() (length, size, capacity, evictions int64, oldest time.Time) + func (lru *LRUCache) StatsJSON() string + type Stats struct + Evictions uint64 + Hits uint64 + Misses uint64 + Removals uint64 + Writes uint64 + type Value interface + Size func() int