aboutsummaryrefslogtreecommitdiff
path: root/pkg/commands/keys.go
diff options
context:
space:
mode:
authoralex <[email protected]>2026-07-12 15:00:16 +0200
committeralex <[email protected]>2026-07-12 15:00:16 +0200
commit6cb3313793bf45e197b3048f0abd2f600bf97bb5 (patch)
tree019a0995c7f9422ec9d739c77379ee7cc1a96b9c /pkg/commands/keys.go
parentce9d9f8b2183bc0a31bfa40e780ae07182bc7cf8 (diff)
downloadredis-clone-6cb3313793bf45e197b3048f0abd2f600bf97bb5.tar.xz
redis-clone-6cb3313793bf45e197b3048f0abd2f600bf97bb5.zip
multi exec and discardmulti/execute
Diffstat (limited to 'pkg/commands/keys.go')
-rw-r--r--pkg/commands/keys.go32
1 files changed, 15 insertions, 17 deletions
diff --git a/pkg/commands/keys.go b/pkg/commands/keys.go
index b233964..40d9277 100644
--- a/pkg/commands/keys.go
+++ b/pkg/commands/keys.go
@@ -19,23 +19,21 @@ func Keys(args []string, getShard func(k string) *core.Shard) interface{} {
limit = val
}
- return dbInstance.ExecuteReadAll(func(shards []*core.Shard) interface{} {
- var matches []string
- for _, shard := range shards {
- for key := range shard.Data {
- matched, err := filepath.Match(pattern, key)
- if err != nil {
- return errors.New("illegal glob pattern")
- }
- if matched {
- matches = append(matches, key)
- }
+ var matches []string
+ for _, shard := range dbInstance.Shards {
+ for key := range shard.Data {
+ matched, err := filepath.Match(pattern, key)
+ if err != nil {
+ return errors.New("illegal glob pattern")
+ }
+ if matched {
+ matches = append(matches, key)
}
}
- sort.Strings(matches)
- if limit != -1 && len(matches) > limit {
- matches = matches[:limit]
- }
- return matches
- })
+ }
+ sort.Strings(matches)
+ if limit != -1 && len(matches) > limit {
+ matches = matches[:limit]
+ }
+ return matches
}