Skip to content

module Athena::HTTP::Session::Storage::Interface #

Manages the lifecycle of an AHTTP::Session: loading and persisting its data and bags, as well as its ID.

Direct including types

Athena::HTTP::Session::Storage

Methods#

abstract #bag(name : String) : AHTTP::Session::BagInterface#

Returns the bag registered with the provided name, starting the session if needed.

View source

abstract #clear : Nil#

Clears all session data.

View source

abstract #id : String#

Returns the ID of the session, or an empty string if it does not have one yet.

View source

abstract #id=(id : String)#

Sets the ID of the session to load once it is started.

View source

abstract #metadata_bag : AHTTP::Session::Storage::MetadataBag#

Returns the bag storing the session's metadata.

View source

abstract #name : String#

Returns the name of the session, i.e. the name of its cookie.

View source

abstract #name=(name : String)#

Sets the name of the session.

View source

abstract #regenerate(destroy : Bool = false, lifetime : Int32 | Nil = nil) : Bool#

Gives the session a new ID while keeping its data, optionally removing the persisted data of the current ID if destroy is true. Optionally sets the lifetime of its cookie in seconds, 0 meaning until the browser is closed.

Returns true if the session was given a new ID, otherwise false.

View source

abstract #register_bag(bag : AHTTP::Session::BagInterface) : Nil#

Registers the provided bag, whose data is loaded and persisted along with the session.

View source

abstract #save : Nil#

Persists the session data and closes the session.

View source

abstract #start : Bool#

Starts the session, loading its data. Returns true once the session is started.

View source

abstract #started? : Bool#

Returns true if the session is started, otherwise false.

View source