No-Cache
A Craft CMS Twig extension that escapes caching inside cache blocks
{% cache %}
This will be cached
{% nocache %}
This won't be
{% endnocache %}
{% endcache %}
It also works when disabling the cache from included files:
{% cache %}
This will be cached
{% include 'template' %}
{% endcache %}
template.twig:
{% nocache %}
This won't be
{% endnocache %}
If you need to reference variables outside of the nocache
tag, you will need to pass a context – much like how the include
tag works when passing variables. Note that you do not have to pass global variables, such as craft
or currentUser
, but you will have to import your macros again.
{% set variable = 5 %}
{% nocache with {x: variable} %}
The following value should be 5: {{ x }}
{% endnocache %}
- Installation Instructions
To install this plugin, copy the command above to your terminal.
- Active Installs
- 3,772
- License
- MIT
- Last release
- November 17, 2023
- Activity (30 days)
- 1Closed Issues0Open Issues0Merged PRs0Open PRs