JSR

An abstract interface for a key–value store.

Properties

Since 1.8.0

optional

cas: (

key: KvKey,

expectedValue: unknown,

newValue: unknown,

) => Promise<boolean>

View code

Compare-and-swap (CAS) operation for the key–value store.

Methods

get<T = unknown>(key: KvKey): Promise<T | undefined>

View code

Gets the value for the given key.

set(

key: KvKey,

value: unknown,

): Promise<void>

View code

Sets the value for the given key.

Deletes the value for the given key.

Since 1.10.0

Since 2.0.0 This method is now required instead of optional.

list(prefix?: KvKey): AsyncIterable<KvStoreListEntry>

View code

Lists all entries in the store that match the given prefix. If no prefix is given, all entries are returned.

Read the original on jsr.io ↗