Clarify that the OnEvicted function isn't called when an item is overwritten
This commit is contained in:
parent
e9441b12e0
commit
ac0fcef49b
4
cache.go
4
cache.go
@ -853,8 +853,8 @@ func (c *cache) DeleteExpired() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Sets an (optional) function that is called with the key and value when an
|
// Sets an (optional) function that is called with the key and value when an
|
||||||
// item is evicted from the cache. (Including when it is deleted manually.)
|
// item is evicted from the cache. (Including when it is deleted manually, but
|
||||||
// Set to nil to disable.
|
// not when it is overwritten.) Set to nil to disable.
|
||||||
func (c *cache) OnEvicted(f func(string, interface{})) {
|
func (c *cache) OnEvicted(f func(string, interface{})) {
|
||||||
c.mu.Lock()
|
c.mu.Lock()
|
||||||
defer c.mu.Unlock()
|
defer c.mu.Unlock()
|
||||||
|
Loading…
Reference in New Issue
Block a user