diff --git a/cache.go b/cache.go index db88d2f..e198c11 100644 --- a/cache.go +++ b/cache.go @@ -1064,7 +1064,12 @@ func (c *cache) ItemCount() int { // Delete all items from the cache. func (c *cache) Flush() { c.mu.Lock() - c.items = map[string]Item{} + for k := range c.items { + v, evicted := c.delete(k) + if evicted { + c.onEvicted(k, v) + } + } c.mu.Unlock() }