Skip to content

@xtandard/kit/storage/memory

@xtandard/kit/storage/memory — in-memory storage (zero deps; tests, dev, single-process apps), watchable and compare-and-swap capable, with an onWrite hook for product indexes.

import { … } from "@xtandard/kit/storage/memory";
Name Summary
createMemoryStorage Create an in-memory MemoryKvStorage. watch callbacks fire on the next microtask after a write or remove; compareAndSwap compares structurally (own properties, key order ignored) and is race-free in-process.
Name Summary
MemoryStorageOptions Options for createMemoryStorage.
Name Summary
MemoryKvStorage The memory storage: watchable and compare-and-swap capable.
MemoryWriteHook A write hook (ADR 0004): called after every successful write with the key and the new value, or null after a remove (whether or not the key existed). Products mirror keys into their own indexes with it (wh mirrors due keys for claimDue). An error thrown by the hook rejects the write call; the write itself has already happened.