aboutsummaryrefslogtreecommitdiff
path: root/pkg/commands/dbsize.go
diff options
context:
space:
mode:
authoralex <[email protected]>2026-07-12 13:48:32 +0200
committeralex <[email protected]>2026-07-12 13:48:32 +0200
commit89b3019a3ab77a3e72720342fc0e5bea996fa4f2 (patch)
treeed9482c87ff2eaa52ba8359654e0e923a4732e30 /pkg/commands/dbsize.go
parent80100f574d8cf6c231217678356324d8ffa7140f (diff)
downloadredis-clone-89b3019a3ab77a3e72720342fc0e5bea996fa4f2.tar.xz
redis-clone-89b3019a3ab77a3e72720342fc0e5bea996fa4f2.zip
refactored all functions to use the command registry
Diffstat (limited to 'pkg/commands/dbsize.go')
-rw-r--r--pkg/commands/dbsize.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/pkg/commands/dbsize.go b/pkg/commands/dbsize.go
new file mode 100644
index 0000000..dbe39a4
--- /dev/null
+++ b/pkg/commands/dbsize.go
@@ -0,0 +1,15 @@
+package commands
+
+import (
+ "redisClone/pkg/core"
+)
+
+func Dbsize(args []string, getShard func(k string) *core.Shard) interface{} {
+ return dbInstance.ExecuteReadAll(func(shards []*core.Shard) interface{} {
+ count := 0
+ for _, shard := range shards {
+ count += len(shard.Data)
+ }
+ return count
+ })
+}