Skip to content
ParticleDB
Release candidateParticleDB 1.1.19-rc.17 is not yet GA or ready for production data.Release status →

Work with key-value data

Use key-value data for direct lookups, counters and expiration. Choose either the supported SQL functions or an existing Redis client, based on your application.

Set a value with an expiry, read it back and count with an atomic increment. The Go and Rust clients have no expiry helper, so they set it with KV_EXPIRE through their query call.

Uses db from the connect example.

db.kv_set("session:42", "active")
db.kv_command("EXPIRE", "session:42", 3600)  # expires in an hour
print(db.kv_get("session:42").decode())
db.kv_incr("visits:42")
print(db.kv_incr("visits:42"))
Output
active
2
SELECT KV_SET('docs:session:1', 'active');
SELECT KV_GET('docs:session:1') AS status;

The read returns active.

Use an application and account prefix, such as app:account:record. Keep credentials and private data out of key names, which may appear in logs or diagnostics.

Redis-compatible clients expose strings, lists, sets and other supported structures. See Redis compatibility and the command reference for exact syntax and limits.

A list operation is not automatically a durable workflow scheduler. Check blocking behavior, acknowledgements, retry handling and the atomicity of each operation before building a worker queue. Do not assume a SQL transaction includes commands sent over a separate client connection.

Redis compatibility · Agents and workflows