ZDEL
Deletes a key from the ZMap ordered key-value store.
Syntax
Section titled “Syntax”ZDEL <key>Parameters
Section titled “Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
key | bytes | Yes | The key to delete. |
Return Value
Section titled “Return Value”Simple string: OK on success.
Behavior
Section titled “Behavior”ZDEL removes a key and its associated value from the ZMap subspace of the session’s current namespace, backed by
FoundationDB.
The operation is idempotent: deleting a non-existent key returns OK without raising an error.
The command supports two transaction modes:
- Auto-commit (one-off): When no explicit transaction is active, Kronotop creates a transaction, performs the delete, and commits it immediately. This is the default mode.
- Explicit transaction: When a
BEGINhas been issued, the delete is staged in the current transaction and only takes effect whenCOMMITis called.
All data is scoped to the session’s active namespace. The same key in different namespaces refers to different entries.
Errors
Section titled “Errors”| Error Code | Description |
|---|---|
ERR | Wrong number of arguments or internal failure. |
Examples
Section titled “Examples”Delete an existing key:
> ZSET mykey "Hello"OK
> ZDEL mykeyOK
> ZGET mykey(nil)Delete a non-existent key:
> ZDEL nosuchkeyOKUse within an explicit transaction:
> ZSET mykey "Hello"OK
> BEGINOK
> ZDEL mykeyOK
> COMMITOK
> ZGET mykey(nil)