aboutsummaryrefslogtreecommitdiff
path: root/pkg/commands/dbsize.go
diff options
context:
space:
mode:
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
+ })
+}