GenieSession.Session - Type
mutable struct Session

Represents a session object


GenieSession.__init__-Tuple{} - Method
init() :: Nothing

Sets up the session functionality, if configured.


GenieSession.get-Tuple{Session, Symbol} - Method
get(s::Session, key::Symbol) :: Union{Nothing,Any}

Returns the value stored on the Session object s as key, wrapped in a Union{Nothing,Any}.


GenieSession.get-Union{Tuple{T}, Tuple{Session, Symbol, T}} where T - Method
get(s::Session, key::Symbol, default::T) :: T where T

Attempts to retrive the value stored on the Session object s as key. If the value is not set, it returns the default.


GenieSession.id-Tuple{HTTP.Messages.Request, HTTP.Messages.Response} - Method
id(req::HTTP.Request, res::HTTP.Response) :: String

Attempts to retrieve the session id from the provided request and response objects. If that is not available, a new session id is created.


GenieSession.id-Tuple{Union{HTTP.Messages.Request, HTTP.Messages.Response}} - Method
id(payload::Union{HTTP.Request,HTTP.Response}) :: String

Attempts to retrieve the session id from the provided payload object. If that is not available, a new session id is created.


GenieSession.id-Tuple{} - Method
id() :: String

Generates a new session id.


GenieSession.isset-Tuple{Union{Nothing, Session}, Symbol} - Method
isset(s::Session, key::Symbol) :: Bool

Checks wheter or not key exists on the Session s.


GenieSession.load - Function
load(session_id::String) :: Session

Loads session data from persistent storage - delegates to the underlying SessionAdapter.


GenieSession.persist - Function
persist(s::Session) :: Session

Generic method for persisting session data - delegates to the underlying SessionAdapter.


GenieSession.session - Function
session(params::Dict{Symbol,Any}) :: Sessions.Session

Returns the Session object associated with the current HTTP request.


GenieSession.set!-Tuple{Session, Symbol, Any} - Method
set!(s::Session, key::Symbol, value::Any) :: Session

Stores value as key on the Session object s.


GenieSession.start - Function
start(req::HTTP.Request, res::HTTP.Response; options::Dict{String,String} = Dict{String,String}()) :: Session

Initiates a new default session object, generating a new session id.

Arguments

  • req::HTTP.Request: the request object
  • res::HTTP.Response: the response object
  • options::Dict{String,String}: extra options for setting the session cookie, such as Path and HttpOnly

GenieSession.start-Tuple{String, HTTP.Messages.Request, HTTP.Messages.Response} - Method
start(session_id::String, req::HTTP.Request, res::HTTP.Response; options = Dict{String,String}()) :: Tuple{Session,HTTP.Response}

Initiates a new HTTP session with the provided session_id.

Arguments

  • session_id::String: the id of the session object
  • req::HTTP.Request: the request object
  • res::HTTP.Response: the response object
  • options::Dict{String,String}: extra options for setting the session cookie, such as Path and HttpOnly

GenieSession.unset!-Tuple{Session, Symbol} - Method
unset!(s::Session, key::Symbol) :: Session

Removes the value stored on the Session s as key.