sessions / Exports / BasicSessionStore
Class: BasicSessionStore
Basic in-memory session store implementation
Provides simple session storage using a Map for development and testing. Sessions are lost when the application restarts. For production use, consider implementing a persistent store using a database.
See
../../../apps/examples/04-sessions | Session Examples
Implements
SessionStore
Table of contents
Constructors
Methods
Constructors
constructor
• new BasicSessionStore(): BasicSessionStore
Returns
Methods
save
▸ save(session
): Promise
<void
>
Save a session to the in-memory store
Creates a deep copy to prevent external modifications affecting stored data.
Parameters
Name | Type | Description |
---|---|---|
session | SessionInfo | Session information to save |
Returns
Promise
<void
>
Implementation of
SessionStore.save
Defined in
packages/sessions/src/session-manager/basic-session-store.ts:79
load
▸ load(sessionId
): Promise
<null
| SessionInfo
>
Load a session from the in-memory store
Returns a copy to prevent external modifications affecting stored data.
Parameters
Name | Type | Description |
---|---|---|
sessionId | string | Unique session identifier |
Returns
Promise
<null
| SessionInfo
>
Session information or null if not found
Implementation of
SessionStore.load
Defined in
packages/sessions/src/session-manager/basic-session-store.ts:91
delete
▸ delete(sessionId
): Promise
<boolean
>
Delete a session from the in-memory store
Parameters
Name | Type | Description |
---|---|---|
sessionId | string | Unique session identifier |
Returns
Promise
<boolean
>
True if session was deleted, false if not found
Implementation of
SessionStore.delete
Defined in
packages/sessions/src/session-manager/basic-session-store.ts:102
list
▸ list(userId?
): Promise
<SessionInfo
[]>
List sessions, optionally filtered by user
Parameters
Name | Type | Description |
---|---|---|
userId? | string | Optional user ID to filter sessions |
Returns
Promise
<SessionInfo
[]>
Array of session information copies
Implementation of
SessionStore.list
Defined in
packages/sessions/src/session-manager/basic-session-store.ts:112
exists
▸ exists(sessionId
): Promise
<boolean
>
Check if a session exists in the in-memory store
Parameters
Name | Type | Description |
---|---|---|
sessionId | string | Unique session identifier |
Returns
Promise
<boolean
>
True if session exists
Implementation of
SessionStore.exists
Defined in
packages/sessions/src/session-manager/basic-session-store.ts:128
clear
▸ clear(): Promise
<void
>
Clear all sessions from the in-memory store
Returns
Promise
<void
>
Implementation of
SessionStore.clear
Defined in
packages/sessions/src/session-manager/basic-session-store.ts:135
size
▸ size(): number
Get the current number of stored sessions
Utility method for monitoring and debugging.
Returns
number
Number of sessions in the store
Defined in
packages/sessions/src/session-manager/basic-session-store.ts:146
getAllSessions
▸ getAllSessions(): SessionInfo
[]
Get all sessions as an array
Utility method for bulk operations and debugging. Returns copies to prevent external modifications.
Returns
Array of all session information
Defined in
packages/sessions/src/session-manager/basic-session-store.ts:158