Documentation
    Preparing search index...

    Class Session

    Index

    Constructors

    Properties

    Accessors

    Methods

    Constructors

    Properties

    id: string

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

    The SessionStore object used to store session data

    Accessors

    Methods

    • Get a single value from the session data in memory.

      Type Parameters

      • K extends string | number

      Parameters

      • key: K

        The property to retrieve from the session data.

      Returns SessionData[K]

      The value corresponding to the given key.

    • 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

      `await this.set(key, prop).save()`
      
    • Set or update one or more values in memory only. If you need to persist changes immediately, call the save function.

      Type Parameters

      • K extends string

      Parameters

      • key: K
      • value: unknown

      Returns this

      `await this.set(key, prop).save()`