Key-value API
Types
Methods
set
set
kv.set(key: string, value: Value)
Params: a key
and corresponding value
.
Returns: A promise resolving to true
on success or false
on failure.
Set a key-value pair in the store. Overwrites existing values.
get
get
kv.get(key: string, allowCachedValue: boolean = true)
Params: A key
to retrieve. If allowCachedValue
is true
, we will check the cache before querying Urbit.
Returns: A promise resolving to a Value
or undefined
if the key does not exist.
Get the value associated with a key in the store.
remove
remove
kv.remove(key: string)
Params: a key
to remove.
Returns: A promise resolving to true
on success or false
on failure.
Remove a key-value pair from the store. If the key
does not exist, returns true
.
clear
clear
kv.clear()
Returns: A promise resolving to true
on success or false
on failure.
Clear all key-value pairs from the store.
all
all
kv.all(useCache: boolean = false)
Params: If useCache
is true
, return the current cache instead of querying Urbit. Only relevant if preload
was set to false
.
Returns: A promise resolving to a Map<string, Value>>
Get all key-value pairs in the store.
Last updated