mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-01 03:03:10 -06:00
Evict cache entry if it's found to be stale when we call Get
This commit is contained in:
parent
eb9e90a30c
commit
2e2d40b7ba
|
|
@ -153,6 +153,7 @@ func (c *InMemoryLRUCachePartition) Get(key string) (value interface{}, ok bool)
|
||||||
return nil, false
|
return nil, false
|
||||||
}
|
}
|
||||||
if c.maxAge > 0 && time.Since(entry.created) > c.maxAge {
|
if c.maxAge > 0 && time.Since(entry.created) > c.maxAge {
|
||||||
|
c.lru.Remove(key)
|
||||||
return nil, false
|
return nil, false
|
||||||
}
|
}
|
||||||
return entry.value, true
|
return entry.value, true
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue