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