StorageAdapter
A storage adapter is an abstraction that provides read, write, and delete access to a storage solution of any kind. Storage adapters are used to keep session middleware independent of your database provider, and they allow you to pass your own storage solution.
Properties
read
ts
read: (key: string) => MaybePromise<T | undefined>;
Reads a value for the given key from the storage. May return the value or undefined, or a promise of either.
write
ts
write: (key: string, value: T) => MaybePromise<void>;
Writes a value for the given key to the storage.
delete
ts
delete: (key: string) => MaybePromise<void>;
Deletes a value for the given key from the storage.
has
ts
has?: (key: string) => MaybePromise<boolean>;
Checks whether a key exists in the storage.
readAllKeys
ts
readAllKeys?: () => Iterable<string> | AsyncIterable<string>;
Lists all keys.
readAllValues
ts
readAllValues?: () => Iterable<T> | AsyncIterable<T>;
Lists all values.
readAllEntries
ts
readAllEntries?: () => Iterable<[string, T]> | AsyncIterable<[string, T]>;
Lists all keys with their values.