Capy-Bearer Documentation

kv_get

lib call

Capy

function kv_get(key : string) any

Description

kv_get() reads a value from the shared cache. The cache lives in the runtime's own memory, is shared by every worker, and holds any any shape. The result is a copy of what was stored.

Parameters

key : the entry key

Return Values

the stored value, or none when the key is missing or expired

Example

Capy

kv_set("doc-greeting", { text: "hello" }, 60)
print(kv_get("doc-greeting").text, " ", get_type_name(kv_get("doc-missing")), "\n")

Output

hello none