From 518f375dfdff0063cfde151228d2a7b082303a0a Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Tue, 23 Mar 2021 19:03:36 +0300 Subject: [PATCH] [#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 --- cmd/neofs-node/cache.go | 1 - 1 file changed, 1 deletion(-) diff --git a/cmd/neofs-node/cache.go b/cmd/neofs-node/cache.go index be4c98d59..48b8ad875 100644 --- a/cmd/neofs-node/cache.go +++ b/cmd/neofs-node/cache.go @@ -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 }