From f0ec35478af23846242c6c5f9c9d39ddb33aa928 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Tue, 15 Mar 2022 11:37:00 +0300 Subject: [PATCH] [#1236] neofs-node: Neofs-node: Remove mutex from `ttlNetCache` Signed-off-by: Evgenii Stratonikov --- cmd/neofs-node/cache.go | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/cmd/neofs-node/cache.go b/cmd/neofs-node/cache.go index bf87a7b0a..57b6431fe 100644 --- a/cmd/neofs-node/cache.go +++ b/cmd/neofs-node/cache.go @@ -1,7 +1,6 @@ package main import ( - "sync" "time" lru "github.com/hashicorp/golang-lru" @@ -25,8 +24,6 @@ type valueWithTime struct { // entity that provides TTL cache interface. type ttlNetCache struct { - mtx sync.Mutex - ttl time.Duration sz int @@ -55,9 +52,6 @@ func newNetworkTTLCache(sz int, ttl time.Duration, netRdr netValueReader) *ttlNe // // returned value should not be modified. func (c *ttlNetCache) get(key interface{}) (interface{}, error) { - c.mtx.Lock() - defer c.mtx.Unlock() - val, ok := c.cache.Peek(key) if ok { valWithTime := val.(*valueWithTime) @@ -83,16 +77,10 @@ func (c *ttlNetCache) get(key interface{}) (interface{}, error) { } func (c *ttlNetCache) remove(key interface{}) { - c.mtx.Lock() - defer c.mtx.Unlock() - c.cache.Remove(key) } func (c *ttlNetCache) keys() []interface{} { - c.mtx.Lock() - defer c.mtx.Unlock() - return c.cache.Keys() }