Constructors

Properties

_data: SessionData = {}

The data stored in the SessionStore that is retrieved with a session id

dirty: SessionData = {}

Track fields that have been updated via calls to set or pop

expires: number = -1

When the session expires in terms of seconds since epoch (Unix)

id: string

The cookie name used to store the session id in the browser

maxAge: number

Max age of the session, in seconds. The default is 24 hours.

The SessionStore object used to store session data

Accessors

Methods

  • Attempts to lock the session row. Also updates the data with the current data from the database. If it was not successful, then the rows must already be locked. If the function fails for some other reason, an exception will be thrown.

    Parameters

    • lockVerificationValue: string

    Returns Promise<boolean>

    whether the attempt to lock the session row was successful

  • Saves the state to the session store, if there are changes

    Parameters

    • force: boolean = false

      Skips the check for changes to the state

    Returns Promise<void>

  • Set or update one or more values in memory only. If you need to persist changes immediately, call the save function.

    Parameters

    • items: Partial<SessionData>

      an object of items to add or update

    Returns this

    Example

    `await this.set(key, prop).save()`
    
  • Type Parameters

    • K extends string | number

    Parameters

    Returns this