class Telecr::Session::MemoryStore

Overview

MemoryStore stores session data in RAM with expiration. Updated for 2026 performance standards.

Defined in:

session/memory_store.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(default_ttl : Int32 = 300, cleanup_interval : Int32 = 300, backup_path : String | Nil = nil, backup_interval : Int32 = 60) #

[View source]

Instance Method Detail

def backup! #

Atomic backup to disk


[View source]
def cleanup #

Remove all expired entries (Safely)


[View source]
def get(key) : JSON::Any | Nil #

Retrieve a value by key


[View source]
def increment(key, amount = 1, ttl = nil) : Int64 #

Increment a numeric value (Atomic-lite for fibers)


[View source]
def restore! #

Restore from disk with validation


[View source]
def set(key, value : JSON::Any, ttl : Int32 | Nil = nil) : JSON::Any #

Store a value with optional TTL


[View source]