Commit 0bd47567 authored by Takashi Kusumi's avatar Takashi Kusumi

LRUExpireCache#Get requires write lock

parent dc529a03
......@@ -25,7 +25,7 @@ import (
type LRUExpireCache struct {
cache *lru.Cache
lock sync.RWMutex
lock sync.Mutex
}
func NewLRUExpireCache(maxSize int) *LRUExpireCache {
......@@ -46,8 +46,8 @@ func (c *LRUExpireCache) Add(key lru.Key, value interface{}, ttl time.Duration)
}
func (c *LRUExpireCache) Get(key lru.Key) (interface{}, bool) {
c.lock.RLock()
defer c.lock.RUnlock()
c.lock.Lock()
defer c.lock.Unlock()
e, ok := c.cache.Get(key)
if !ok {
return nil, false
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment