module Components::Cache::Cacheable

Overview

Mixin for components that support caching

Direct including types

Defined in:

components/cache/cacheable.cr

Class Method Summary

Macro Summary

Instance Method Summary

Class Method Detail

def self.cache_enabled #

[View source]
def self.cache_enabled=(value : Bool) #

Whether caching is enabled globally


[View source]
def self.cache_store #

[View source]
def self.cache_store=(value : CacheStore | Nil) #

The cache store to use for this component


[View source]
def self.default_expires_in #

[View source]
def self.default_expires_in=(value : Time::Span | Nil) #

Default cache expiration time


[View source]

Macro Detail

macro cache_fragment(key, expires_in = nil) #

Generate a cache fragment for a block of content


[View source]

Instance Method Detail

def cache(expires_in : Time::Span | Nil = nil, &block : -> String) : String #

Cache the rendered output of this component


[View source]
def cache_with_dependencies(dependencies : Array(Cacheable), expires_in : Time::Span | Nil = nil, &block : -> String) : String #

Russian doll caching support


[View source]
def invalidate_cache : Nil #

Invalidate this component's cache


[View source]
def touch_cache : Nil #

Touch the cache to update timestamps (for dependency tracking)


[View source]
def warm_cache(expires_in : Time::Span | Nil = nil) : String #

Warm the cache for this component


[View source]