class Marten::Template::Tag::Cache
- Marten::Template::Tag::Cache
- Marten::Template::Tag::Base
- Reference
- Object
Overview
The cache
template tag.
The cache
template tag allows to cache the content of a template fragment (enclosed within the
{% cache %}...{% endcache %}
tags) for a specific duration.
At least a cache key and and a cache expiry (expressed in seconds) must be specified when using this tag:
{% cache "mykey" 3600 %}
Cached content!
{% endcache %}
It should be noted that the cache
template tag also supports specifying additional "vary on" arguments that
allow to invalidate the cache based on the value of other template variables:
{% cache "mykey" 3600 current_locale user.id %}
Cached content!
{% endcache %}
Included Modules
Defined in:
marten/template/tag/cache.crConstructors
Instance Method Summary
-
#render(context : Context) : String
Render the template tag for a given context.
Instance methods inherited from module Marten::Template::Tag::CanSplitSmartly
split_smartly(expression : String) : Array(String)
split_smartly
Instance methods inherited from class Marten::Template::Tag::Base
render(context : Context) : String
render
Constructor methods inherited from class Marten::Template::Tag::Base
new(parser : Parser, source : String)
new
Constructor Detail
Instance Method Detail
Description copied from class Marten::Template::Tag::Base
Render the template tag for a given context.