interface ISessionStore
Since 0.2.0

Server-side session storage port.

Implemented by the plugin's MemorySessionStore and CacheSessionStore, and by any application-supplied backend. Only the store strategy uses it; the default cookie strategy keeps the payload in the cookie and needs no store.

Every method is async so a network-backed store fits without change.

Methods

read(id: string): Promise<SessionData | null>

Reads a stored session payload.

write(
id: string,
ttlMs: number
): Promise<void>

Writes a session payload, replacing any existing one.

destroy(id: string): Promise<boolean>

Removes a stored session.

optional
isHealthy(): Promise<boolean>

Reports the store's reachability, for the plugin's health indicator.

Optional: a store with no meaningful liveness check omits it, and the indicator then reports only that a store is configured.

optional
close(): Promise<void>

Releases resources held by the store (timers, connections).

Optional: called from the plugin's onClose. A store holding nothing omits it.

Usage

import { type ISessionStore } from "common/src/index.ts";