From 19b8acb5aedf6a20e82fe3313a5800138d011a1d Mon Sep 17 00:00:00 2001 From: Francisco Date: Thu, 6 Apr 2023 15:57:21 +0700 Subject: [PATCH] hotfix: fix get multi on disable caching --- keeper.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/keeper.go b/keeper.go index fa2b4b7..cf4df3c 100644 --- a/keeper.go +++ b/keeper.go @@ -367,6 +367,9 @@ func (k *keeper) GetOrSet(key string, fn GetterFn, opts ...func(Item)) (res []by // TODO: refactor this when you are bored func (k *keeper) GetMultipleOrLock(keys []string) (cachedItems []any, mutexes []*redsync.Mutex, err error) { if k.disableCaching { + for range keys { + cachedItems = append(cachedItems, nil) + } return } @@ -1007,6 +1010,9 @@ func (k *keeper) GetHashMemberOrLock(identifier string, key string) (cachedItem // TODO: refactor this when you are bored func (k *keeper) GetMultiHashMembersOrLock(identifiers []string, keys []string) (cachedItems []any, mutexes []*redsync.Mutex, err error) { if k.disableCaching { + for range keys { + cachedItems = append(cachedItems, nil) + } return }