KV
A key-value store bound to env.NAME, backed by a single SQLite table.
Configuration
"kv_namespaces": ["SESSIONS"]
Bare names are auto-provisioned on deploy — see Storage resources.
Usage
env.SESSIONS.put("k", "v"); // value is stringified
env.SESSIONS.get("k"); // -> "v" or null
env.SESSIONS.delete("k");
env.SESSIONS.list("prefix"); // -> string[] of keys, up to 1000
Methods
| Method | Signature | Returns |
|---|---|---|
put |
(key: string, value: string) |
void — value is stringified |
get |
(key: string) |
string | null |
delete |
(key: string) |
void |
list |
(prefix?: string) |
string[] — up to 1000 keys |
Related
- Storage resources and auto-provisioning
- Manage and export KV data — CLI-driven key listing, bulk get/put/delete, and export