optimize
This commit is contained in:
parent
f6a5cf4255
commit
7978e9ee74
4
cache/map.go
vendored
4
cache/map.go
vendored
|
@ -147,13 +147,13 @@ func (m *MapCache[K, V]) GetBatchToMap(c context.Context, key []K, timeout time.
|
||||||
}
|
}
|
||||||
func (m *MapCache[K, V]) getBatchToMap(e Expend[K, V]) func(c context.Context, key []K, timeout time.Duration, params ...any) (map[K]V, error) {
|
func (m *MapCache[K, V]) getBatchToMap(e Expend[K, V]) func(c context.Context, key []K, timeout time.Duration, params ...any) (map[K]V, error) {
|
||||||
return func(ctx context.Context, key []K, timeout time.Duration, params ...any) (map[K]V, error) {
|
return func(ctx context.Context, key []K, timeout time.Duration, params ...any) (map[K]V, error) {
|
||||||
var res = make(map[K]V)
|
var res map[K]V
|
||||||
var needIndex = make(map[K]int)
|
|
||||||
var err error
|
var err error
|
||||||
mm, err := e.Gets(ctx, key)
|
mm, err := e.Gets(ctx, key)
|
||||||
if err != nil || len(key) == len(mm) {
|
if err != nil || len(key) == len(mm) {
|
||||||
return mm, err
|
return mm, err
|
||||||
}
|
}
|
||||||
|
var needIndex = make(map[K]int)
|
||||||
res = mm
|
res = mm
|
||||||
var flushKeys []K
|
var flushKeys []K
|
||||||
for i, k := range key {
|
for i, k := range key {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user