|
|
@ -100,12 +100,12 @@ func (x *LayLRU[K, V]) GetBatch(keys []K, fetch func(keys []K) (map[K]V, error))
|
|
|
|
setVs := make(map[K]*layLruItem[V])
|
|
|
|
setVs := make(map[K]*layLruItem[V])
|
|
|
|
for _, key := range keys {
|
|
|
|
for _, key := range keys {
|
|
|
|
v, ok := x.core.Get(key)
|
|
|
|
v, ok := x.core.Get(key)
|
|
|
|
if ok {
|
|
|
|
|
|
|
|
x.lock.Unlock()
|
|
|
|
x.lock.Unlock()
|
|
|
|
|
|
|
|
if ok {
|
|
|
|
v.lock.Lock()
|
|
|
|
v.lock.Lock()
|
|
|
|
expires, value, err1 := v.expires, v.value, v.err
|
|
|
|
expires, value, err1 := v.expires, v.value, v.err
|
|
|
|
if expires != 0 && expires > time.Now().UnixMilli() {
|
|
|
|
|
|
|
|
v.lock.Unlock()
|
|
|
|
v.lock.Unlock()
|
|
|
|
|
|
|
|
if expires != 0 && expires > time.Now().UnixMilli() {
|
|
|
|
x.target.IncrGetHit()
|
|
|
|
x.target.IncrGetHit()
|
|
|
|
res[key] = value
|
|
|
|
res[key] = value
|
|
|
|
if err1 != nil {
|
|
|
|
if err1 != nil {
|
|
|
@ -117,7 +117,6 @@ func (x *LayLRU[K, V]) GetBatch(keys []K, fetch func(keys []K) (map[K]V, error))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
queries = append(queries, key)
|
|
|
|
queries = append(queries, key)
|
|
|
|
x.lock.Unlock()
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
values, err1 := fetch(queries)
|
|
|
|
values, err1 := fetch(queries)
|
|
|
|
if err1 != nil {
|
|
|
|
if err1 != nil {
|
|
|
|