Skip to content

Sessions

Danny edited this page Jun 21, 2022 · 3 revisions

The session is a series of helpers for accessing a in-memory stored key, value data for users. The session is included in each context object created, and can be accessed with context.session.

Methods

session.set(userId: string, key: string, value: any): void

Will take a user ID, a key, and a value, and set the value in the session for that user.

session.get(userId: string, key: string): any

Will take a user ID, and a key, and return the value in the session for that user.

session.remove(userId: string, key: string): void

Will take a user ID, and a key, and remove the value in the session for that user.

session.clear(userId: string): void

Will take a user ID, and remove all values in the session for that user.

session.getAll(userId: string): Record<string, any>

Will take a user ID, and return all values in the session for that user.