aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralex <[email protected]>2026-07-08 21:11:52 +0200
committeralex <[email protected]>2026-07-08 21:11:52 +0200
commit917b08a98cb310d05170d2ef3de9847419e3990e (patch)
treed2c797c86ea23beb8e6926239070ff2391d6edd4
parentaac1dd50b61090461cefc0263f065140be4bf50b (diff)
downloadredis-clone-917b08a98cb310d05170d2ef3de9847419e3990e.tar.xz
redis-clone-917b08a98cb310d05170d2ef3de9847419e3990e.zip
fixed bug regarding DEL
-rw-r--r--handlers.go4
-rw-r--r--main.go2
2 files changed, 3 insertions, 3 deletions
diff --git a/handlers.go b/handlers.go
index 980e805..b4668f8 100644
--- a/handlers.go
+++ b/handlers.go
@@ -82,12 +82,12 @@ func handleDel(conn net.Conn, args []string) {
conn.Write(serializeRESP(err))
return
}
- keys := args[:1]
+ keys := args[1:]
deletedKeys := db.ExecuteMulti(keys, func(shards []*Shard) interface{}{
count := 0
for _, key := range keys{
shard := db.getShard(key)
- _, exists := shard.data[key]
+ _, exists := shard.data[key]
if exists {
delete(shard.data, key)
count += 1
diff --git a/main.go b/main.go
index 2dc5b12..8acef78 100644
--- a/main.go
+++ b/main.go
@@ -18,7 +18,7 @@ type handlerFunc func(net.Conn, []string)
var commandRegistry = map[string]handlerFunc{
"GET": handleGet,
"SET": handleSet,
-// "DEL": handleDel,
+ "DEL": handleDel,
"EXISTS": handleExists,
/* "INCR": handleIncr,
"DECR": handleDecr,