From b1291d9dbe1477d17c8a222f46f985e1ea9db850 Mon Sep 17 00:00:00 2001 From: Durand Fabrice Date: Wed, 3 Jan 2018 09:44:03 -0500 Subject: [PATCH] Delete from the cache on Get if the item expired (to trigger onEvicted) --- cache.go | 1 + 1 file changed, 1 insertion(+) diff --git a/cache.go b/cache.go index db88d2f..35aa7dd 100644 --- a/cache.go +++ b/cache.go @@ -128,6 +128,7 @@ func (c *cache) Get(k string) (interface{}, bool) { if item.Expiration > 0 { if time.Now().UnixNano() > item.Expiration { c.mu.RUnlock() + c.Delete(k) return nil, false } }