Skip to content

Commit

Permalink
remove update cb
Browse files Browse the repository at this point in the history
  • Loading branch information
c3mb0 committed Jul 3, 2020
1 parent 4c1219f commit cc571b4
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 11 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 0 additions & 10 deletions niftycache.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ type Cache struct {
ttl time.Duration
removeCB callback
setCB callback
updateCB callback
expireCB callback
extendTTL bool
items map[string]*item
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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))
}
}
}

0 comments on commit cc571b4

Please sign in to comment.