diff --git a/lru/lru.go b/lru/lru.go index 47f13528..b0c4779e 100644 --- a/lru/lru.go +++ b/lru/lru.go @@ -44,6 +44,11 @@ func NewWithEvictionFunc(size int, f EvictionFunc) *Cache { return c } +// SetEvictionFunc updates the eviction func +func (c *Cache) SetEvictionFunc(f EvictionFunc) { + c.cache.OnEvicted = f +} + // Add adds a value to the cache. func (c *Cache) Add(key Key, value interface{}) { c.lock.Lock()