[#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:
Alex Vanin 2021-03-23 19:03:36 +03:00 committed by Leonard Lyubich
parent 8d5c17facd
commit 518f375dfd

View file

@ -60,7 +60,6 @@ func (c *ttlNetCache) get(key interface{}) (interface{}, error) {
valWithTime := val.(*valueWithTime)
if time.Since(valWithTime.t) < c.ttl {
valWithTime.t = time.Now()
return valWithTime.v, nil
}