Skip to content

Commit

Permalink
fix: lru lock
Browse files Browse the repository at this point in the history
  • Loading branch information
icey-yu committed Sep 12, 2024
1 parent de20311 commit 34ced79
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/localcache/lru/lru_lazy.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ func (x *LayLRU[K, V]) GetBatch(keys []K, fetch func(keys []K) (map[K]V, error))
v, ok := x.core.Get(key)
x.lock.Unlock()
if ok {
v.lock.Lock()
expires, value, err1 := v.expires, v.value, v.err
v.lock.Unlock()
if expires != 0 && expires > time.Now().UnixMilli() {
x.target.IncrGetHit()
res[key] = value
Expand Down

0 comments on commit 34ced79

Please sign in to comment.