Delete from the cache on Get if the item expired (to trigger onEvicted)
This commit is contained in:
parent
a3647f8e31
commit
b1291d9dbe
1
cache.go
1
cache.go
|
@ -128,6 +128,7 @@ func (c *cache) Get(k string) (interface{}, bool) {
|
||||||
if item.Expiration > 0 {
|
if item.Expiration > 0 {
|
||||||
if time.Now().UnixNano() > item.Expiration {
|
if time.Now().UnixNano() > item.Expiration {
|
||||||
c.mu.RUnlock()
|
c.mu.RUnlock()
|
||||||
|
c.Delete(k)
|
||||||
return nil, false
|
return nil, false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue