Versions in this module Expand all Collapse all v0 v0.1.0 Aug 9, 2023 Changes in this version + type Cache struct + func New(size int) (*Cache[K, V], error) + func NewWithEvict(size int, onEvicted func(key K, value V)) (*Cache[K, V], error) + func (c *Cache[K, V]) Add(key K, value V) (evicted bool) + func (c *Cache[K, V]) Contains(key K) bool + func (c *Cache[K, V]) ContainsOrAdd(key K, value V) (ok, evicted bool) + func (c *Cache[K, V]) Get(key K) (value V, ok bool) + func (c *Cache[K, V]) Len() int + func (c *Cache[K, V]) Peek(key K) (value V, ok bool) + func (c *Cache[K, V]) PeekOrAdd(key K, value V) (previous V, ok, evicted bool) + func (c *Cache[K, V]) Purge() + func (c *Cache[K, V]) Remove(key K) (present bool) + func (c *Cache[K, V]) Resize(size int) (evicted int) + type ShardedCache struct + func NewSharded(size, shardCount int) (*ShardedCache[V], error) + func NewShardedWithEvict(size, shardCount int, onEvicted func(key string, value V)) (*ShardedCache[V], error) + func (c *ShardedCache[V]) Add(key string, value V) (evicted bool) + func (c *ShardedCache[V]) Contains(key string) bool + func (c *ShardedCache[V]) ContainsOrAdd(key string, value V) (ok, evicted bool) + func (c *ShardedCache[V]) Get(key string) (value V, ok bool) + func (c *ShardedCache[V]) Len() int + func (c *ShardedCache[V]) Peek(key string) (value V, ok bool) + func (c *ShardedCache[V]) PeekOrAdd(key string, value V) (previous V, ok, evicted bool) + func (c *ShardedCache[V]) Purge() + func (c *ShardedCache[V]) Remove(key string) (present bool)