Spaces and structures
The key-value surface over HTTP — keys with expiry, conditional set and counters, plus the list, hash, set and ranking operations — each one the engine's own operation, never a reimplementation.
A space is the store's key-value engine, and the app surface serves all of it: the cache verbs and the structure families.
Keys
| method | path | answers |
|---|---|---|
| GET | …/spaces/{s}/keys?prefix= | {"keys": […]} |
| GET | …/keys/{key} | {"value": v, "ttl": … | null} or 404 |
| PUT | …/keys/{key} | body one JSON value; {"set": bool} |
| DELETE | …/keys/{key} | {"deleted": true} |
| POST | …/keys/{key}/incr?by=n | {"value": n} |
The key is the rest of the path, percent-encoded. PUT takes two query
modifiers:
?expire=30m— the key dies at its instant, likeSET … EXPIRE.?if=absent/?if=present— a conditional set; the answer's"set"says whether it landed, and a condition that did not hold is a200with"set": false, not an error.
Remember the space rule: a plain SET clears an expiry. Refreshing a
session key means sending expire again, every time.
Structures
A key holding a list, hash, set or ranking is operated on with
POST …/keys/{key}/{family}/{op} and a JSON body. Each answers
{"value": …} — the operation's own answer: a length, a count, an element, a
pair.
- list —
push{values, at?: front|back, if?}·pop{at?, limit?}·set{index, value}·trim{from, to}·remove{value, limit?, from_back?}·insert{value, before|after}·move{to, from?, at?} - hash —
set{fields: {…}, if?: absent}·remove{fields: […]}·incr{field, by}·expire{fields, at: "<dur>", if?}·ttl{fields}·persist{fields} - members (sets) —
add/remove{members: […]}·pop{limit?}·move{member, to} - scores (rankings) —
add{members: {member: score}, if?, changed?}·incr{member, by}·remove{members}or{rank: {from, to}}or{score|member_range: {…}}·pop{highest?, limit?}
# A job queue on a list.
curl -X POST -H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' \
'http://127.0.0.1:8000/v1/app/main/spaces/cache/keys/jobs/list/push' \
-d '{"values": ["resize:42", "mail:17"], "at": "back"}'
# {"value":2}
# A leaderboard.
curl -X POST -H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' \
'http://127.0.0.1:8000/v1/app/main/spaces/cache/keys/top/scores/add' \
-d '{"members": {"ada": 10, "bob": 7}}'
A word the operation chooses between — front|back, before|after — is a
closed set in the body, picked server-side; a field the operation does not
take is a 400 naming it. A key already holding another kind answers the
engine's own refusal (KeyHoldsAnotherKind, 400): a list key does not
become a hash by asking nicely, exactly as in the language.
Every operation is the engine's own — the same atomicity, the same expiry semantics, the same grant checks a TessariQL statement meets. The surface adds no cache logic of its own, which is what makes it safe to mix: a key written over HTTP reads back identically in a script, in a client, and through the RESP port.