Skip to main content
Module

x/mandarinets/mod.ts>MandarineSecurity.Sessions.SessionStore

Mandarine.TS is a typescript, decorator-driven framework that allows you to create server-side applications. Mandarine.TS provides a range of built-in solutions such as Dependency Injection, Components, ORM and more. Under its umbrella, Mandarine.TS has 4 modules: Core, Data, Security and MVC, these modules will offer you the requirements to build a Mandarine-powered application.
Latest
interface MandarineSecurity.Sessions.SessionStore
import { type MandarineSecurity } from "https://deno.land/x/mandarinets@v2.3.2/mod.ts";
const { SessionStore } = MandarineSecurity.Sessions;

Represents how a SessionStore implementation should be designed. SessionStore is used to design & use the process of manipulating sessions

Methods

optional
launch(): void

Prepares session store. Called when mounting session container during Mandarine Build Time (MBT).

get(sessionID: string, config?: { touch: boolean; }): Mandarine.Security.Sessions.MandarineSession | undefined

Gets a session. If it does not exist returns undefined. If param config.touch = true, updates the expiration of the session

getAll(): Array<Mandarine.Security.Sessions.MandarineSession>

Gets all the sessions in the session container

set(
sessionID: string,
session: Mandarine.Security.Sessions.MandarineSession,
config?: { override: boolean; },
): Mandarine.Security.Sessions.MandarineSession

Adds a session to the session container. For overriding, set config.override to true

destroy(sessionID: string): void

Removes a session from the session container if it exists

touch(sessionID: string): Mandarine.Security.Sessions.MandarineSession | undefined

Updates the expiration of a session

exists(sessionID: string): boolean

Verifies whether a session exists

clearExpiredSessions(): void

Handles the elimination of all expired sessions. This function is called in an internal interval managed by Mandarine.

getDefaultExpiration(): number

Expiration time of a session (IN MS) Default: (1000 * 60 * 60 * 24) (1 day)

getExpirationInterval(): number

Interval in milliseconds to call expired sessions cleaner Default: (1000 * 60 * 60) (1 hour)

getAutoclearExpiredSessions(): boolean

Returns a boolean specifying whether expired sessions should be autocleared by an internal handler