Sign in

Type: MonoCloudSessionStore

Defines a storage adapter used to persist authentication sessions.

Implement this interface to store sessions outside the default cookie-based storage — for example in Redis, a database, or a distributed cache.

Methods

delete()

delete(key: string): Promise<void>

Removes a session from the store.

Parameters

ParameterTypeDescription
keystringUnique identifier of the session to delete.

Returns

Promise<void>


get()

get(key: string): Promise<MonoCloudSession | null | undefined>

Retrieves a session associated with the provided key.

Parameters

ParameterTypeDescription
keystringUnique identifier of the session.

Returns

Promise<MonoCloudSession | null | undefined>

Returns the stored session, or undefined / null if no session exists.


set()

set(key: string, data: MonoCloudSession, lifetime: SessionLifetime): Promise<void>

Persists or updates a session.

The provided lifetime information can be used by the store to configure TTL/expiration policies.

Parameters

ParameterTypeDescription
keystringUnique identifier of the session.
dataMonoCloudSessionThe session data to persist.
lifetimeSessionLifetimeSession lifetime metadata (creation, update, expiration).

Returns

Promise<void>

© 2024 MonoCloud. All rights reserved.