abstract class HTTPSession::Storage(T)

Overview

A base class for implementing storage backends.

Included Modules

Direct Known Subclasses

Defined in:

storage.cr

Instance Method Summary

Instance methods inherited from module HTTPSession::StorageInterface(T)

[](session_id : String) : T | Nil [], []=(session_id : String, session : T) : Nil []=, delete(session_id : String) : Nil delete, has?(session_id : String) : Bool has?, new_session_id : String new_session_id

Instance Method Detail

def [](session_id : String) : T | Nil #
Description copied from module HTTPSession::StorageInterface(T)

Fetches the storage value for session_id. Returns nil if no value exists.


[View source]
def []=(session_id : String, session : T) : Nil #
Description copied from module HTTPSession::StorageInterface(T)

Sets the storage value for session_id.


[View source]
abstract def delete_expired(min : Time) : Nil #

Deletes all expired storage values, i.e. which have not been touched since time.


[View source]
abstract def fetch(session_id : String) : Entry(T) | Nil #

Fetches an entry indicated by session_id. Returns nil if no entry exists.


[View source]
def gc_interval : Time::Span #

The interval for deleting expired session values.


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

The interval for deleting expired session values.


[View source]
def max_age : Time::Span #

The maximum age.


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

The maximum age.


[View source]
abstract def put(session_id : String, entry : Entry(T)) : Nil #

Sets the entry for session_id.


[View source]
def run_gc_loop #

Runs a loop that call #delete_expired every interval of #gc_interval.


[View source]