createMemorySessionStore
An in-memory session store for development and single-process servers.
An in-memory session store for development and single-process servers. Bounded: at most
maxEntries sessions, least recently used evicted first; expired records are dropped on read.
Records are copied on the way in and out, so callers cannot change stored state by accident.
Import#
ts
import { createMemorySessionStore } from "@shadow-js/dusk/server";
Signature#
ts
function createMemorySessionStore(
options: MemorySessionStoreOptions = {},
): SessionStore & { readonly size: number }
Parameters#
| Name | Description |
|---|---|
options |
Bound and clock. |
Returns#
The store with a size for tests and metrics.
Examples#
ts
const store = createMemorySessionStore({ maxEntries: 5_000 });