class

Azu::Cache::Store

Inherits Reference < Object

Base cache store interface

Instance methods

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

Decrement counter WARNING: Base implementation is NOT thread-safe for concurrent access MemoryStore and RedisStore override with atomic implementations

Source
delete(key : String) : Bool
Source
exists?(key : String) : Bool
Source
fetch(key : String, ttl : Time::Span | Nil = nil, & : -> String) : String

Rails-like fetch method with block support (preferred method)

Source
get(key : String) : String | Nil
Source
get(key : String, ttl : Time::Span | Nil = nil, & : -> String) : String

Overloaded get method with block and TTL support @deprecated Use fetch instead for Rails-like cache-aside pattern. The get method with a block is deprecated and will be removed in a future version. Replace: cache.get("key", ttl: 1.hour) { compute_value } With: cache.fetch("key", ttl: 1.hour) { compute_value }

Source
get_multi(keys : Array(String)) : Hash(String, String | Nil)

Multi-get support

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

Increment counter (for stores that support it) WARNING: Base implementation is NOT thread-safe for concurrent access MemoryStore and RedisStore override with atomic implementations

Source
set(key : String, value : String, ttl : Time::Span | Nil = nil) : Bool
Source
set_multi(values : Hash(String, String), ttl : Time::Span | Nil = nil) : Bool

Multi-set support

Source
size
Source