From cc571b4cf1eca36695eb4ffca59939e50800860e Mon Sep 17 00:00:00 2001 From: Cem Sancak Date: Fri, 3 Jul 2020 17:02:34 +0300 Subject: [PATCH] remove update cb --- README.md | 1 - niftycache.go | 10 ---------- 2 files changed, 11 deletions(-) diff --git a/README.md b/README.md index 429754e..a730d43 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,6 @@ cache := niftycache.New(10*time.Minute, niftycache.ExpireCallback(cb), niftycache.RemoveCallback(cb), niftycache.SetCallback(cb), - niftycache.UpdateCallback(cb), // controls whether a successful cache hit extends the item's ttl (default false) niftycache.ExtendTTLOnHit(), // controls the max amount of items that can be expired at once (default 10000) diff --git a/niftycache.go b/niftycache.go index 9ed5a0d..eafe5cc 100644 --- a/niftycache.go +++ b/niftycache.go @@ -11,7 +11,6 @@ type Cache struct { ttl time.Duration removeCB callback setCB callback - updateCB callback expireCB callback extendTTL bool items map[string]*item @@ -47,12 +46,6 @@ func RemoveCallback(f Callback) Option { } } -func UpdateCallback(f Callback) Option { - return func(nc *Cache) { - nc.updateCB = createCBClosure(f) - } -} - func SetCallback(f Callback) Option { return func(nc *Cache) { nc.setCB = createCBClosure(f) @@ -223,8 +216,5 @@ func (nc *Cache) Set(key string, value interface{}) { } else { item.update(value) nc.ih.update(item) - if nc.updateCB != nil { - nc.callbacks.Add(nc.updateCB(key, value)) - } } }