class
Azu::Cache::MemoryStore
- Azu::Cache::MemoryStore
- Azu::Cache::Store
- Reference
- Object
Overview
Memory-based cache store with LRU eviction
Defined in:
azu/cache.crConstant Summary
-
DEFAULT_MAX_SIZE =
1000 -
DEFAULT_TTL =
Time::Span.new(hours: 1)
Constructors
Instance Method Summary
- #clear : Bool
-
#decrement(key : String, amount : Int32 = 1, ttl : Time::Span | Nil = nil) : Int32 | Nil
Override decrement with atomic implementation
- #delete(key : String) : Bool
- #exists?(key : String) : Bool
- #get(key : String) : String | Nil
-
#increment(key : String, amount : Int32 = 1, ttl : Time::Span | Nil = nil) : Int32 | Nil
Override increment with atomic implementation
- #set(key : String, value : String, ttl : Time::Span | Nil = nil) : Bool
- #size : Int32
-
#stats : Hash(String, Int32 | Float64)
Memory store specific methods
-
#stop_cleanup_task
Stop cleanup task (for testing or shutdown)
Instance methods inherited from class Azu::Cache::Store
clear : Bool
clear,
decrement(key : String, amount : Int32 = 1, ttl : Time::Span | Nil = nil) : Int32 | Nil
decrement,
delete(key : String) : Bool
delete,
exists?(key : String) : Bool
exists?,
fetch(key : String, ttl : Time::Span | Nil = nil, & : -> String) : String
fetch,
get(key : String) : String | Nilget(key : String, ttl : Time::Span | Nil = nil, & : -> String) : String get, get_multi(keys : Array(String)) : Hash(String, String | Nil) get_multi, increment(key : String, amount : Int32 = 1, ttl : Time::Span | Nil = nil) : Int32 | Nil increment, set(key : String, value : String, ttl : Time::Span | Nil = nil) : Bool set, set_multi(values : Hash(String, String), ttl : Time::Span | Nil = nil) : Bool set_multi, size : Int32 size
Constructor Detail
def self.new(max_size : Int32 = DEFAULT_MAX_SIZE, default_ttl : Time::Span | Nil = DEFAULT_TTL, cleanup_interval : Time::Span = 5.minutes)
#
Instance Method Detail
Override decrement with atomic implementation
Override increment with atomic implementation