class Kemal::Session

Defined in:

kemal-session.cr
kemal-session/base.cr
kemal-session/config.cr
kemal-session/engine.cr
kemal-session/engines/file.cr
kemal-session/engines/memory.cr
kemal-session/gc.cr
kemal-session/storable_object.cr

Constant Summary

STORABLE_TYPES = [] of Nil

Constructors

Class Method Summary

Instance Method Summary

Macro Summary

Constructor Detail

def self.new(ctx : HTTP::Server::Context) #

[View source]
def self.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


[View source]

Class Method Detail

def self.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


[View source]
def self.config(&) #

[View source]
def self.config #

[View source]
def self.destroy(id : String) #

Removes a session from storage


[View source]
def self.destroy_all #

Destroys all of the sessions stored in the storage engine


[View source]
def self.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.


[View source]
def self.get(id : String) #

Retrieves a single session


[View source]

Instance Method Detail

def bigint(k : String, v : Int64) #

[View source]
def bigint(k : String) : Int64 #

[View source]
def bigint?(k : String) : Int64 | Nil #

[View source]
def bigints : Hash(String, Int64) #

[View source]
def bool(k : String, v : Bool) #

[View source]
def bool(k : String) : Bool #

[View source]
def bool?(k : String) : Bool | Nil #

[View source]
def bools : Hash(String, Bool) #

[View source]
def delete_bigint(k : String) #

[View source]
def delete_bool(k : String) #

[View source]
def delete_float(k : String) #

[View source]
def delete_int(k : String) #

[View source]
def delete_object(k : String) #

[View source]
def delete_string(k : String) #

[View source]
def 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.


[View source]
def float(k : String, v : Float64) #

[View source]
def float(k : String) : Float64 #

[View source]
def float?(k : String) : Float64 | Nil #

[View source]
def floats : Hash(String, Float64) #

[View source]
def id : String #

[View source]
def int(k : String, v : Int32) #

[View source]
def int(k : String) : Int32 #

[View source]
def int?(k : String) : Int32 | Nil #

[View source]
def ints : Hash(String, Int32) #

[View source]
def object(k : String, v : Session::StorableObject::StorableObjects) #

[View source]
def object(k : String) : Session::StorableObject::StorableObjects #

[View source]
def object?(k : String) : Session::StorableObject::StorableObjects | Nil #

[View source]
def objects : Hash(String, Session::StorableObject::StorableObjects) #

[View source]
def 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


[View source]
def string(k : String, v : String) #

[View source]
def string(k : String) : String #

[View source]
def string?(k : String) : String | Nil #

[View source]
def strings : Hash(String, String) #

[View source]

Macro Detail

macro abstract_engine(vars) #

[View source]