:sig
function kv_set(key : string, value : as dval, ttl_seconds : u64 = 3600) bool

:params
key : the entry key, at most 1024 bytes
value : the value to store, any dval shape
ttl_seconds : seconds until the entry expires, 0 for no expiry

:returns
`true` when the value was stored

:content
`kv_set()` stores a copy of `value` under `key` in the shared cache. A later `kv_set()` replaces the entry and its expiry. A value larger than one megabyte is not stored and the call returns `false`.

The cache has a fixed size (`KV_CACHE_BYTES`, 64 MB by default). When it is full, the least recently used entries make room. Contents live as long as the runtime process does.

:example capy render
print(kv_set("doc-count", 3, 60), " ", s64(kv_get("doc-count")), "\n")

:output
true 3

:see-group
kv
