From 76f1250a65318992f63b2fc75baafbe62e63a7a6 Mon Sep 17 00:00:00 2001 From: Patrick Mylund Nielsen Date: Mon, 30 Nov 2015 16:18:49 -0500 Subject: [PATCH] Make OnEvicted() a little faster --- cache.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cache.go b/cache.go index 4f44ba2..d58c603 100644 --- a/cache.go +++ b/cache.go @@ -906,8 +906,8 @@ func (c *cache) DeleteExpired() { // not when it is overwritten.) Set to nil to disable. func (c *cache) OnEvicted(f func(string, interface{})) { c.mu.Lock() - defer c.mu.Unlock() c.onEvicted = f + c.mu.Unlock() } // Write the cache's items (using Gob) to an io.Writer.