abstract class Components::Cache::CacheStore

Overview

Abstract base class for cache stores

Direct Known Subclasses

Defined in:

components/cache/cache_store.cr

Instance Method Summary

Instance Method Detail

abstract def clear : Nil #

Clear all cached values


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

Delete a value from cache


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

Check if a key exists


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

Fetch a value from cache, or compute and store it if not present


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

Read a value from cache


[View source]
def stats : Hash(String, Int32 | Int64) #

Get statistics about the cache


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

Write a value to cache


[View source]