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 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]