class

Marten::HTTP::Session::Store::Base

Inherits Reference / Object

Abstract base session store.

Constructors

new(session_key : String | Nil)
Source

Instance methods

[](key : String | Symbol)

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

Source
[]=(key : String | Symbol, value : String)

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

Source
[]?(key : String | Symbol)

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

Source
accessed?

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

Source
clear_expired_entries
Source
create

Creates a new session store.

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

Source
cycle_key

Regenerates the session key while keeping all the existing data.

Source
delete(key : String | Symbol)

Allows to delete a session value for a specific key.

Source
each(*args, **options)
Source
each(*args, **options, &)
Source
empty?

Returns true if the session store is empty.

Source
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.

Source
expires_at=(value : Time)

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

Source
expires_at_browser_close=(value : Bool)

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

Source
expires_at_browser_close?
Source
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.

Source
expires_in=(value : Time::Span)

Allows to set the session expiration time.

Source
expires_in=(value : Int64)

Allows to set the session expiration time in seconds.

Source
fetch(key : String | Symbol, default = nil)

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

Source
fetch(key : String | Symbol, &)

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

Source
flush

Flushes the session store data.

Source
has_key?(key : String | Symbol)

Returns true if the provided key exists.

Source
load

Loads the session store data and returns the corresponding hash.

Source
modified?

Returns true if the session store was modified.

Source
save

Saves the session store data.

Source
session_key
Source
size(*args, **options)

Returns the number of keys in the session hash.

Source
size(*args, **options, &)

Returns the number of keys in the session hash.

Source

Nested types