abstract class
Azu::Cache::Store
- Azu::Cache::Store
- Reference
- Object
Overview
Base cache store interface
Direct Known Subclasses
Defined in:
azu/cache.crInstance Method Summary
- #clear : Bool
-
#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
- #delete(key : String) : Bool
- #exists?(key : String) : Bool
-
#fetch(key : String, ttl : Time::Span | Nil = nil, & : -> String) : String
Rails-like fetch method with block support (preferred method)
- #get(key : String) : String | Nil
- #get(key : String, ttl : Time::Span | Nil = nil, & : -> String) : String
-
#get_multi(keys : Array(String)) : Hash(String, String | Nil)
Multi-get support
-
#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
- #set(key : String, value : String, ttl : Time::Span | Nil = nil) : Bool
-
#set_multi(values : Hash(String, String), ttl : Time::Span | Nil = nil) : Bool
Multi-set support
- #size : Int32
Instance Method Detail
Decrement counter
WARNING Base implementation is NOT thread-safe for concurrent access MemoryStore and RedisStore override with atomic implementations
Rails-like fetch method with block support (preferred method)
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 }
DEPRECATED Use #fetch instead for cache-aside pattern with block
Increment counter (for stores that support it)
WARNING Base implementation is NOT thread-safe for concurrent access MemoryStore and RedisStore override with atomic implementations
Multi-set support