From 7978e9ee740b83bcbbfbff50a65237398f2c2ccd Mon Sep 17 00:00:00 2001 From: xing Date: Tue, 7 Nov 2023 15:39:38 +0800 Subject: [PATCH] optimize --- cache/map.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cache/map.go b/cache/map.go index 933f1b6..71b7e73 100644 --- a/cache/map.go +++ b/cache/map.go @@ -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) { return func(ctx context.Context, key []K, timeout time.Duration, params ...any) (map[K]V, error) { - var res = make(map[K]V) - var needIndex = make(map[K]int) + var res map[K]V var err error mm, err := e.Gets(ctx, key) if err != nil || len(key) == len(mm) { return mm, err } + var needIndex = make(map[K]int) res = mm var flushKeys []K for i, k := range key {