Skip to content

Commit 76f1250

Browse files
committed
Make OnEvicted() a little faster
1 parent 7c1e7f5 commit 76f1250

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cache.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -906,8 +906,8 @@ func (c *cache) DeleteExpired() {
906906
// not when it is overwritten.) Set to nil to disable.
907907
func (c *cache) OnEvicted(f func(string, interface{})) {
908908
c.mu.Lock()
909-
defer c.mu.Unlock()
910909
c.onEvicted = f
910+
c.mu.Unlock()
911911
}
912912

913913
// Write the cache's items (using Gob) to an io.Writer.

0 commit comments

Comments
 (0)