forked from TrueCloudLab/frostfs-node
[#1236] neofs-node: Neofs-node: Remove mutex from ttlNetCache
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
22b1208a20
commit
f0ec35478a
1 changed files with 0 additions and 12 deletions
|
@ -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()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue