Skip to content

Adapter

Signature

export interface Adapter

Properties

Methods

scan(query: string, keys?: false): Awaitable<any[]>;scan(query: string, keys: true): Awaitable<string[]>;scan(query: string, keys?: boolean): Awaitable<(any | string)[]>;
bulkSet(entries: AdapterEntry[]): Awaitable<void>;

Stores every entry atomically. The batch itself is not atomic and implementations may execute entries concurrently or out of order. If the operation rejects, any subset may already be committed, but no writes remain pending after the returned promise settles.

bulkPatch(entries: AdapterEntry[]): Awaitable<void>;

Patches every entry atomically. The batch itself is not atomic and implementations may execute entries concurrently or out of order. If the operation rejects, any subset may already be committed, but no writes remain pending after the returned promise settles.

increment?(key: string, field: string, delta: number, options?: AdapterIncrementOptions): Awaitable<number | undefined>;

Atomically adds a finite delta to an own, finite numeric field of an existing object record and returns its new value. Returns undefined without writing for missing/expired records, non-record values (including arrays), and missing/nonnumeric fields. Preserves other fields and the owning relationship, using the adapter's normal patch expiration policy. Invalid delta/min values or a nonfinite result reject without modifying the entry. No work remains pending after the returned promise settles. Implementations must serialize this operation with other writes to the key. Omit this capability when the backend cannot provide an atomic update; a get followed by patch is insufficient.

bulkRemove(keys: string[]): Awaitable<void>;

Removes every entry atomically. The batch itself is not atomic and implementations may execute entries concurrently or out of order. If the operation rejects, any subset may already be committed, but no removals remain pending after the returned promise settles.

remove(key: string): Awaitable<void>;

Removes the value and its owning relationship as one logical operation.

removeToRelationship(to: string, keys: string | string[]): Awaitable<void>;

Removes the selected values and relationships owned by `to`.

removeRelationship(to: string | string[]): Awaitable<void>;

Removes every value and relationship owned by the supplied relationships.