Skip to content

RedisKvStorage

Defined in: src/storage/redis.ts:87

A watchable, compare-and-swap capable storage backed by Redis, plus close().

close(): Promise<void>;

Defined in: src/storage/redis.ts:89

Disconnect the client if this driver created it; no-op for a borrowed one.

Promise<void>


compareAndSwap<T>(input): Promise<boolean>;

Defined in: src/storage/contract.ts:66

Atomically write next when the key currently holds a value structurally equal to expected (object key order ignored), or is absent when expected is null. Resolves true when the write happened. Of several concurrent swaps from the same expected, exactly one wins.

Type Parameter
T
Parameter Type
input CompareAndSwapInput<T>

Promise<boolean>

CompareAndSwapKvStorage.compareAndSwap


getItem<T>(key): Promise<T | null>;

Defined in: src/storage/contract.ts:15

Read a value, or null if absent.

Type Parameter
T
Parameter Type
key string

Promise<T | null>

WatchableKvStorage.getItem


getKeys(prefix): Promise<string[]>;

Defined in: src/storage/contract.ts:21

List all keys beginning with prefix (a plain, case-sensitive string prefix).

Parameter Type
prefix string

Promise<string[]>

WatchableKvStorage.getKeys


removeItem(key): Promise<void>;

Defined in: src/storage/contract.ts:19

Delete a key (no-op if absent).

Parameter Type
key string

Promise<void>

WatchableKvStorage.removeItem


setItem<T>(key, value): Promise<void>;

Defined in: src/storage/contract.ts:17

Write a value (overwriting any existing).

Type Parameter
T
Parameter Type
key string
value T

Promise<void>

WatchableKvStorage.setItem


watch(prefix, callback): Promise<() => void>;

Defined in: src/storage/contract.ts:35

Subscribe to changes under prefix. Resolves to an unsubscribe function.

Parameter Type
prefix string
callback (event) => void

Promise<() => void>

WatchableKvStorage.watch