forked from TrueCloudLab/frostfs-node
[#441] cmd/neofs-node: Don't update access time in ttlNetCache
ttlNetCache should evict records after TTL duration. However if data is often accessed and there are no LRU eviction (cache used with small number of keys), then data will not be evicted ever. This is a invalid behaviour for mutable data such as eACL. Solution is to not update access time on every get, so the data will be guarantee evicted after TTL duration. Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
parent
8d5c17facd
commit
518f375dfd
1 changed files with 0 additions and 1 deletions
|
@ -60,7 +60,6 @@ func (c *ttlNetCache) get(key interface{}) (interface{}, error) {
|
||||||
valWithTime := val.(*valueWithTime)
|
valWithTime := val.(*valueWithTime)
|
||||||
|
|
||||||
if time.Since(valWithTime.t) < c.ttl {
|
if time.Since(valWithTime.t) < c.ttl {
|
||||||
valWithTime.t = time.Now()
|
|
||||||
return valWithTime.v, nil
|
return valWithTime.v, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue