abstract class Marten::HTTP::Session::Store::Base

Overview

Abstract base session store.

Direct Known Subclasses

Defined in:

marten/http/session/store/base.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(session_key : String | Nil) #

[View source]

Instance Method Detail

def [](key : String | Symbol) #

Returns the value associated with the passed key or raises a KeyError exception if not found.


[View source]
def []=(key : String | Symbol, value : String) #

Allows to set a new session value for a specific key.


[View source]
def []?(key : String | Symbol) #

Returns the value associated with the passed key or returns nil if not found.


[View source]
def accessed? : Bool #

Returns true if the session store was accessed at least once.


[View source]
abstract def clear_expired_entries : Nil #

[View source]
abstract def create : Nil #

Creates a new session store.

This method should create a new (empty) session store with an associated key and persist it.


[View source]
def cycle_key : Nil #

Regenerates the session key while keeping all the existing data.


[View source]
def delete(key : String | Symbol) #

Allows to delete a session value for a specific key.


[View source]
def each(*args, **options) #

[View source]
def each(*args, **options, &) #

[View source]
def empty? : Bool #

Returns true if the session store is empty.


[View source]
def expires_at #

Returns the time when the session will expire.

This method will return nil if the session is set to expire when the browser is closed.


[View source]
def expires_at=(value : Time) #

Allows to set the date time when the session will expire.


[View source]
def expires_at_browser_close=(value : Bool) #

Allows to set whether the session should expire when the browser is closed.


[View source]
def expires_at_browser_close? : Bool #

[View source]
def expires_in #

Returns the session expiration time.

Unless explicitly set, the default value returned is the one defined by the sessions.cookie_max_age setting.


[View source]
def expires_in=(value : Time::Span) #

Allows to set the session expiration time.


[View source]
def expires_in=(value : Int64) #

Allows to set the session expiration time in seconds.


[View source]
def fetch(key : String | Symbol, default = nil) #

Returns the value associated with the passed key, or the passed default if the key is not found.


[View source]
def fetch(key : String | Symbol, &) #

Returns the value associated with the passed key, or calls a block with the key when not found.


[View source]
abstract def flush : Nil #

Flushes the session store data.


[View source]
def has_key?(key : String | Symbol) #

Returns true if the provided key exists.


[View source]
abstract def load : SessionHash #

Loads the session store data and returns the corresponding hash.


[View source]
def modified? : Bool #

Returns true if the session store was modified.


[View source]
abstract def save : Nil #

Saves the session store data.


[View source]
def session_key : String? #

[View source]
def size(*args, **options) #

Returns the number of keys in the session hash.


[View source]
def size(*args, **options, &) #

Returns the number of keys in the session hash.


[View source]