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?


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 %}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.