forked from TrueCloudLab/frostfs-node
[#1236] neofs-node: Remove mutex from lruNetCache
We already use thread-safe LRU and mutex shouldn't be taken while making
network requests.
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
(cherry picked from commit 22b1208a20
)
This commit is contained in:
parent
5f54fd5dc8
commit
73d367e287
1 changed files with 1 additions and 6 deletions
|
@ -98,14 +98,12 @@ func (c *ttlNetCache) keys() []interface{} {
|
|||
|
||||
// entity that provides LRU cache interface.
|
||||
type lruNetCache struct {
|
||||
mtx sync.Mutex
|
||||
|
||||
cache *lru.Cache
|
||||
|
||||
netRdr netValueReader
|
||||
}
|
||||
|
||||
// complicates netValueReader with LRU caching mechanism.
|
||||
// newNetworkLRUCache returns wrapper over netValueReader with LRU cache.
|
||||
func newNetworkLRUCache(sz int, netRdr netValueReader) *lruNetCache {
|
||||
cache, err := lru.New(sz)
|
||||
fatalOnErr(err)
|
||||
|
@ -122,9 +120,6 @@ func newNetworkLRUCache(sz int, netRdr netValueReader) *lruNetCache {
|
|||
//
|
||||
// returned value should not be modified.
|
||||
func (c *lruNetCache) get(key interface{}) (interface{}, error) {
|
||||
c.mtx.Lock()
|
||||
defer c.mtx.Unlock()
|
||||
|
||||
val, ok := c.cache.Get(key)
|
||||
if ok {
|
||||
return val, nil
|
||||
|
|
Loading…
Reference in a new issue