class

Kemal::Session

Inherits Reference < Object

Constants

STORABLE_TYPES = [] of Nil

Constructors

new(id : String)

When initializing a Session with a string, it's disassociated with an active request and response being handled by kemal. A dummy Context is created and Session skips the validation check on the session_id

Source

Class methods

all

Retrieves all sessions from session storage as an Array. This will return all sessions in storage and could result in a lot of memory usage. Use with caution. If something more memory efficient is needed, use Session.each

Source
config
Source
config
Source
destroy(id : String)

Removes a session from storage

Source
destroy_all

Destroys all of the sessions stored in the storage engine

Source
each

Enumerates through each session stored. Please read carefully each storage engine with regard to how this method is implemented some may dump all sessions in memory before iterating through them.

Source
get(id : String)

Retrieves a single session

Source

Instance methods

bigint(k : String, v : Int64)
Source
bigint(k : String) : Int64
Source
bigint?(k : String) : Int64 | Nil
Source
bigints
Source
bool(k : String, v : Bool)
Source
bool(k : String) : Bool
Source
bool?(k : String) : Bool | Nil
Source
bools
Source
delete_bigint(k : String)
Source
delete_bool(k : String)
Source
delete_float(k : String)
Source
delete_int(k : String)
Source
delete_object(k : String)
Source
delete_string(k : String)
Source
destroy

Invalidates the session by removing it from storage so that its no longer tracked. If the session is being destroyed in the context of an active request being processed by kemal, the session cookie will be emptied.

Source
float(k : String, v : Float64)
Source
float(k : String) : Float64
Source
float?(k : String) : Float64 | Nil
Source
floats
Source
int(k : String, v : Int32)
Source
int(k : String) : Int32
Source
int?(k : String) : Int32 | Nil
Source
ints
Source
object(k : String, v : Session::StorableObject::StorableObjects)
Source
object(k : String) : Session::StorableObject::StorableObjects
Source
object?(k : String) : Session::StorableObject::StorableObjects | Nil
Source
objects
Source
reset

Resetting the session will remove the contents of the current session from session storage and create a new session for use within the current request. The .destroy method will remove the session from session storage and not create a new session for use within the current request

Source
string(k : String, v : String)
Source
string(k : String) : String
Source
string?(k : String) : String | Nil
Source
strings
Source

Macros

abstract_engine(vars)
Source

Nested types