class

SessionStore

Inherits Reference < Object

In-memory registry of live sessions. Single process, no persistence: this is the constraint that a multi-replica deploy would break.

Constants

CODE_ALPHABET = "ABCDEFGHJKLMNPQRSTUVWXYZ23456789"

Unambiguous alphabet: no 0/O, no 1/I, so a code read aloud is unmistakable.

CODE_LENGTH = 4

Constructors

new(ttl : Time::Span = 3.hours)
Source

Instance methods

find(code : String) : Session | Nil
Source
open(now : Time = Time.utc) : Session
Source
sweep(now : Time = Time.utc) : Int32

Removes every expired session and returns how many were dropped.

Source