We currently use cache tags with a condition referencing the cache
config setting:
{% cache for 1 hour if craft.config.cache %}
Is the condition necessary to stop HTML being inserted into the database cache?
Craft CMS Stack Exchange is a question and answer site for administrators, end users, developers and designers for Craft CMS. It only takes a minute to sign up.
Sign up to join this communityWe currently use cache tags with a condition referencing the cache
config setting:
{% cache for 1 hour if craft.config.cache %}
Is the condition necessary to stop HTML being inserted into the database cache?
No, there is a better way to do this. Set the enableTemplateCaching
config value to false.
'enableTemplateCaching' => false,
With that setting disabled, all caching will be skipped.
// Won't be cached
{% cache for 1 hour %}