Class: InMemorySessionManager

Bravey.SessionManager.InMemorySessionManager

new InMemorySessionManager()

A session manager to be used as sessionManager for Bravey.ContextManager. Stores session IDs in memory.
Parameters:
Name Type Attributes Description
extensions.sessionLength Number <optional>
Session duration in milliseconds. (default is 600000 - 10 minutes)
Source:

Methods

clearData(sessionid) → {boolean}

Empty context data for the specified session ID. Updates the user timestamp, preventing session expiring.
Parameters:
Name Type Description
sessionid string The session ID.
Source:
Returns:
True if sessionid is found and context is set.
Type
boolean

getContext(sessionid) → {Array.<string>}

Get context for the specified session ID.
Parameters:
Name Type Description
sessionid string The session ID.
Source:
Returns:
The related contexts.
Type
Array.<string>

getData(sessionid) → {Array.<string>}

Get context data for the specified session ID.
Parameters:
Name Type Description
sessionid string The session ID.
Source:
Returns:
The related data.
Type
Array.<string>

keepAlive(sessionid) → {boolean}

Keep a session alive, resetting expiration time.
Parameters:
Name Type Description
sessionid string The session ID.
Source:
Returns:
True if sessionid is found and kept alive.
Type
boolean

reserveSessionId() → {string}

Reserves a new session ID. It also clear expired sessions.
Source:
Returns:
The new session ID.
Type
string

setContext(sessionid, contexttags) → {boolean}

Set context for the specified session ID. Updates the user timestamp, preventing session expiring.
Parameters:
Name Type Description
sessionid string The session ID.
contexttags Array.<string> The context tags to be set.
Source:
Returns:
True if sessionid is found and context is set.
Type
boolean

setData(sessionid, data) → {boolean}

Set context data for the specified session ID. Updates the user timestamp, preventing session expiring.
Parameters:
Name Type Description
sessionid string The session ID.
data Object Key/value pair for data to be set.
Source:
Returns:
True if sessionid is found and context is set.
Type
boolean