ZSET.I64
Sets a key to a signed 64-bit integer value in the ZMap ordered key-value store.
Syntax
Section titled “Syntax”ZSET.I64 <key> <value>Parameters
Section titled “Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
key | bytes | Yes | The key to set. |
value | integer | Yes | A signed 64-bit integer to store. |
Return Value
Section titled “Return Value”Simple string: OK on success.
Behavior
Section titled “Behavior”ZSET.I64 writes a typed 64-bit integer value for a key in the ZMap subspace of the session’s current namespace. The
value is encoded as 8 bytes in little-endian two’s complement format, the same encoding used by ZINC.I64 and read by
ZGET.I64.
If the key already exists, its value is overwritten silently.
The full signed 64-bit range is supported: from -9223372036854775808 to 9223372036854775807.
The command supports two transaction modes:
- Auto-commit (one-off): When no explicit transaction is active, Kronotop creates a transaction, performs the write, and commits it immediately. This is the default mode.
- Explicit transaction: When a
BEGINhas been issued, the write is staged in the current transaction and only persists 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, value is not a valid integer, or internal failure. |
Examples
Section titled “Examples”Set an integer value:
> ZSET.I64 counter 42OK
> ZGET.I64 counter(integer) 42Overwrite an existing value:
> ZSET.I64 counter 100OK
> ZSET.I64 counter 200OK
> ZGET.I64 counter(integer) 200Set a negative value:
> ZSET.I64 balance -500OK
> ZGET.I64 balance(integer) -500Use within an explicit transaction:
> BEGINOK
> ZSET.I64 tx-counter 42OK
> COMMITOK
> ZGET.I64 tx-counter(integer) 42