Cache Tag

If you find that a particular chunk of your view logic is the cause of a performance hit — perhaps you're fetching and filtering huge amount of content, or pulling data from an API, caching that portion of your template can remove alleviate any slowdown.


After an initial render, markup inside a cache tag will be pulled from a cached,statically cached copy until invalidated.

{{ cache for="5 minutes" }}
  {{ collection:stocks limit="5000" }}
    <!-- probably lots of stuff happening -->
  {{ /collection:stocks }}
{{ /cache }}

It really only makes sense to use the cache tag if you’re not using another full-site type of caching, like static or full measure. There’s nothing to be gained by caching a cache. That would be like buying four $5 bills with a $20. What have you gained other than a fatter wallet?


for string

The length of time to cache this section. Use plain English to specify the length, eg. 2 hours, 5 minutes, etc.

scope string

Sets the cache scope. The default site scope will cache one instance per tag for the entire site, while a page scope will create a unique cache per URL.

Betterify this page on Github!