module
Components::Cache::Cacheable
Overview
Mixin for components that support caching
Direct including types
Defined in:
components/cache/cacheable.crClass Method Summary
- .cache_enabled
-
.cache_enabled=(value : Bool)
Whether caching is enabled globally
- .cache_store
-
.cache_store=(value : CacheStore | Nil)
The cache store to use for this component
- .default_expires_in
-
.default_expires_in=(value : Time::Span | Nil)
Default cache expiration time
Macro Summary
-
cache_fragment(key, expires_in = nil)
Generate a cache fragment for a block of content
Instance Method Summary
-
#cache(expires_in : Time::Span | Nil = nil, &block : -> String) : String
Cache the rendered output of this component
-
#cache_with_dependencies(dependencies : Array(Cacheable), expires_in : Time::Span | Nil = nil, &block : -> String) : String
Russian doll caching support
-
#invalidate_cache : Nil
Invalidate this component's cache
-
#touch_cache : Nil
Touch the cache to update timestamps (for dependency tracking)
-
#warm_cache(expires_in : Time::Span | Nil = nil) : String
Warm the cache for this component
Class Method Detail
Macro Detail
Instance Method Detail
def cache(expires_in : Time::Span | Nil = nil, &block : -> String) : String
#
Cache the rendered output of this component
def cache_with_dependencies(dependencies : Array(Cacheable), expires_in : Time::Span | Nil = nil, &block : -> String) : String
#
Russian doll caching support