abstract class Azu::Cache::Store

Overview

Base cache store interface

Direct Known Subclasses

Defined in:

azu/cache.cr

Instance Method Summary

Instance Method Detail

abstract def clear : Bool #

[View source]
def 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


[View source]
abstract def delete(key : String) : Bool #

[View source]
abstract def exists?(key : String) : Bool #

[View source]
def fetch(key : String, ttl : Time::Span | Nil = nil, & : -> String) : String #

Rails-like fetch method with block support


[View source]
abstract def get(key : String) : String | Nil #

[View source]
def get(key : String, ttl : Time::Span | Nil = nil, & : -> String) : String #

Overloaded get method with block and TTL support (Rails-like)


[View source]
def get_multi(keys : Array(String)) : Hash(String, String | Nil) #

Multi-get support


[View source]
def 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


[View source]
abstract def set(key : String, value : String, ttl : Time::Span | Nil = nil) : Bool #

[View source]
def set_multi(values : Hash(String, String), ttl : Time::Span | Nil = nil) : Bool #

Multi-set support


[View source]
abstract def size : Int32 #

[View source]