AdonisJS API
    Preparing search index...

    Session client exposes the API to set session data as a client. Useful for testing or programmatic session manipulation.

    const client = new SessionClient(store)
    client.merge({ userId: 123 })
    client.flash({ success: 'Login successful' })
    await client.commit()
    Index
    flashKey: string = '__flash__'

    Session key used for storing flash messages

    sessionId: `${string}-${string}-${string}-${string}-${string}` = ...

    Session ID to use when no explicit session id is defined

    • Commits data to the session store

      Returns Promise<void>

      await client.commit() // Saves all changes to the store
      
    • Destroys the session data from the store

      Parameters

      • OptionalsessionId: string

        Optional session ID to destroy (defaults to current session)

      Returns Promise<void>

      await client.destroy()           // Destroy current session
      await client.destroy('abc123') // Destroy specific session
    • Loads session data from the session store

      Parameters

      • OptionalsessionId: string

        Optional session ID to load (defaults to current session)

      Returns Promise<{ values: any; flashMessages: any }>

      const { values, flashMessages } = await client.load()
      const data = await client.load('abc123') // Load specific session