DEL
DEL removes a key and its value from the engine. Every key pins to exactly
one shard via FNV-1a hashing, so the delete touches a single shard and never
crosses shard boundaries (see Architecture).
RESP2 (Redis-compatible)
Section titled “RESP2 (Redis-compatible)”DEL key [key ...]Removes one or more keys and replies with the number that actually existed and were removed. Deleting a key that doesn’t exist is not an error.
Reply: an integer — 1 per deleted key, 0 when nothing matched.
> SET a 1+OK> DEL a b:1> DEL a:0Native binary protocol
Section titled “Native binary protocol”The client package exposes Delete:
c, _ := client.Dial("127.0.0.1:9988", 2*time.Second)defer c.Close()
scratch := make([]byte, 4096)if _, err := c.Delete([]byte("greeting"), scratch); err != nil { log.Fatal(err)}scratchBuf— a reusable buffer for the server response; it must be large enough to hold the reply.- The binary protocol takes exactly one key per call; for multiple keys,
call
Deleteonce per key.
Error handling
Section titled “Error handling”- Wrong arity replies
-ERR wrong number of arguments for 'del' command. - With RBAC enabled,
DELis gated per key; a denial replies-NOPERM.