class Kemal::Session
- Kemal::Session
- Reference
- Object
Defined in:
kemal-session.crkemal-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
- .new(ctx : HTTP::Server::Context)
-
.new(id : String)
When initializing a Session with a string, it's disassociated with an active request and response being handled by kemal.
Class Method Summary
-
.all
Retrieves all sessions from session storage as an Array.
- .config(&)
- .config
-
.destroy(id : String)
Removes a session from storage
-
.destroy_all
Destroys all of the sessions stored in the storage engine
-
.each(&)
Enumerates through each session stored.
-
.get(id : String)
Retrieves a single session
Instance Method Summary
- #bigint(k : String, v : Int64)
- #bigint(k : String) : Int64
- #bigint?(k : String) : Int64 | Nil
- #bigints : Hash(String, Int64)
- #bool(k : String, v : Bool)
- #bool(k : String) : Bool
- #bool?(k : String) : Bool | Nil
- #bools : Hash(String, Bool)
- #delete_bigint(k : String)
- #delete_bool(k : String)
- #delete_float(k : String)
- #delete_int(k : String)
- #delete_object(k : String)
- #delete_string(k : String)
-
#destroy
Invalidates the session by removing it from storage so that its no longer tracked.
- #float(k : String, v : Float64)
- #float(k : String) : Float64
- #float?(k : String) : Float64 | Nil
- #floats : Hash(String, Float64)
- #id : String
- #int(k : String, v : Int32)
- #int(k : String) : Int32
- #int?(k : String) : Int32 | Nil
- #ints : Hash(String, Int32)
- #object(k : String, v : Session::StorableObject::StorableObjects)
- #object(k : String) : Session::StorableObject::StorableObjects
- #object?(k : String) : Session::StorableObject::StorableObjects | Nil
- #objects : Hash(String, Session::StorableObject::StorableObjects)
-
#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.
- #string(k : String, v : String)
- #string(k : String) : String
- #string?(k : String) : String | Nil
- #strings : Hash(String, String)
Macro Summary
Constructor Detail
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
Class Method Detail
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
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.
Instance Method Detail
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.
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