Skip to content

KV / Cache

Terminal window
# Set with TTL
curl -X PUT https://magnusdb.dev/api/kv/session:abc \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"value": "active", "ttl": 3600}'
# Get
curl https://magnusdb.dev/api/kv/session:abc \
-H "Authorization: Bearer YOUR_API_KEY"
# Delete
curl -X DELETE https://magnusdb.dev/api/kv/session:abc \
-H "Authorization: Bearer YOUR_API_KEY"
Terminal window
curl -X POST https://magnusdb.dev/api/kv/command \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"command": "INCR", "args": ["page:views"]}'
Terminal window
curl -X POST https://magnusdb.dev/api/kv/pipeline \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"commands": [
{"command": "SET", "args": ["lock:job1", "1", "EX", "30"]},
{"command": "GET", "args": ["lock:job1"]}
]
}'

Pipeline commands run sequentially — each result is available before the next command executes.

Simple operations route to Cloudflare KV. Advanced commands (sorted sets, HyperLogLog, streams, pub/sub) route to Upstash Redis when configured.