Skip to main content
Module

x/opine_sessions/mod.ts>Store

Cookie-based sessions module for the Opine web framework.
Latest
interface Store
import { type Store } from "https://deno.land/x/opine_sessions@2.1.1/mod.ts";

A generic store. Implement this and pass an instance of it to init() to use your own database solution instead of the default sqlite.

Properties

createSession: () => Promise<string>

Create a new session.

getSession: (sid: string) => Promise<Record<string, any>>

Get the session contents as a JavaScript object.

set: (
sid: string,
key: string,
val: any,
) => Promise<void>

Set the value associated with key for the session sid.

delete: (sid: string, key: string) => Promise<void>

Delete the value associated with key for the session sid.

clear: (sid: string) => Promise<void>

Clear all session variables associated with a sid.

Methods

get<T>(sid: string, key: string): Promise<T | null>

Get the value associated with key for the session sid.