Versions in this module Expand all Collapse all v1 v1.0.0 Nov 24, 2022 Changes in this version + type AddedFunc func(k Key, old, new Value, updated bool) + func (f AddedFunc[Key, Value]) Added(k Key, old, new Value, updated bool) + func (f AddedFunc[Key, Value]) Removed(k Key, v Value) + type Cache struct + Handler Handler[Key, Value] + Policy Policy[Key, Value] + func New(policy Policy[Key, Value]) *Cache[Key, Value] + func NewWithHandler(policy Policy[Key, Value], handler Handler[Key, Value]) *Cache[Key, Value] + func (c *Cache[Key, Value]) Add(k Key, v Value) + func (c *Cache[Key, Value]) Clear() + func (c *Cache[Key, Value]) Evict() (n int) + func (c *Cache[Key, Value]) Get(k Key) (v Value, hit bool) + func (c *Cache[Key, Value]) Len() int + func (c *Cache[Key, Value]) Remove(k Key) (removed bool) + type Handler interface + Added func(k Key, old, new Value, update bool) + Removed func(k Key, v Value) + type Policy interface + Evict func(k Key, v Value, n int) bool + func MaxCount(n int) Policy[Key, Value] + type PolicyFunc func(k Key, v Value, n int) bool + func (f PolicyFunc[Key, Value]) Evict(k Key, v Value, n int) bool + type RemovedFunc func(k Key, v Value) + func (f RemovedFunc[Key, Value]) Added(_ Key, _, _ Value, _ bool) + func (f RemovedFunc[Key, Value]) Removed(k Key, v Value)