SET, DEL, and INCR
Last updated
This page covers the ToriiDB commands that write, delete, and increment keys, including how trailing options are parsed.
SET
SET <key> <value> [NX|XX] [seconds] [VECTOR]
Options are peeled from the end in this order, and each is only considered while at least two tokens remain:
VECTOR(case-insensitive)- a positive integer → expiry of
now + seconds NXorXX
Because of this, SET version 2 3 stores "2" with a 3-second TTL, while SET n 5 stores 5.
| Failure | Response |
|---|---|
NX on an existing key, XX on a missing key, field write error |
(nil) |
VECTOR with a dotted key |
error: VECTOR not supported on field-level SET |
VECTOR error (no embedder, blank text) |
error: <message> |
DEL
DEL <key> [key2] ...
With one dotted argument, deletes that JSON field and returns OK or (nil). Otherwise deletes top-level keys and returns (integer) <removed>.
INCR
INCR <key> [delta]
delta defaults to 1 and may be fractional; a non-number returns error: delta must be a number. The target must be an existing int/float key or numeric JSON field; anything else returns (nil).