class

Azu::Cache::MemoryStore

Inherits Azu::Cache::Store < Reference < Object

Memory-based cache store with LRU eviction

Constants

DEFAULT_MAX_SIZE = 1000
DEFAULT_TTL = Time::Span.new(hours: 1)

Constructors

new(max_size : Int32 = DEFAULT_MAX_SIZE, default_ttl : Time::Span | Nil = DEFAULT_TTL, cleanup_interval : Time::Span = 5.minutes)
Source

Instance methods

clear
Source
decrement(key : String, amount : Int32 = 1, ttl : Time::Span | Nil = nil) : Int32 | Nil

Override decrement with atomic implementation

Source
delete(key : String) : Bool
Source
exists?(key : String) : Bool
Source
get(key : String) : String | Nil
Source
increment(key : String, amount : Int32 = 1, ttl : Time::Span | Nil = nil) : Int32 | Nil

Override increment with atomic implementation

Source
set(key : String, value : String, ttl : Time::Span | Nil = nil) : Bool
Source
size
Source
stats

Memory store specific methods

Source
stop_cleanup_task

Stop cleanup task (for testing or shutdown)

Source