fix: optimize to lru local cache. (#3514)

* fix: optimize to lru  local cache.

* revert lock timing.
This commit is contained in:
Monet Lee
2025-08-14 10:19:11 +08:00
committed by GitHub
parent d542df7000
commit 34971c8b96
5 changed files with 37 additions and 31 deletions
+3 -3
View File
@@ -35,7 +35,7 @@ type slotLRU[K comparable, V any] struct {
func (x *slotLRU[K, V]) GetBatch(keys []K, fetch func(keys []K) (map[K]V, error)) (map[K]V, error) {
var (
slotKeys = make(map[uint64][]K)
vs = make(map[K]V)
kVs = make(map[K]V)
)
for _, k := range keys {
@@ -49,10 +49,10 @@ func (x *slotLRU[K, V]) GetBatch(keys []K, fetch func(keys []K) (map[K]V, error)
return nil, err
}
for key, value := range batches {
vs[key] = value
kVs[key] = value
}
}
return vs, nil
return kVs, nil
}
func (x *slotLRU[K, V]) getIndex(k K) uint64 {