Answers.Body: <p>No, there is a better way to do this. Set the <code>enableTemplateCaching</code> <a href="https://craftcms.com/docs/config-settings#enableTemplateCaching" rel="nofollow">config value</a> to false.</p>
  
  <pre><code>'enableTemplateCaching' =&gt; false,
  </code></pre>
  
  <p>With that setting disabled, all caching will be skipped.</p>
  
  <pre><code>// Won't be cached
  {% cache for 1 hour %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-09-19T18:01:46.063Z
Answers.LastActivityDate: 2016-09-19T18:01:46.063Z
Answers.UserDisplayName: Lindsey D
Body: <p>We currently use cache tags with a condition referencing the <code>cache</code> config setting:</p>
  
  <pre><code>{% cache for 1 hour if craft.config.cache %}
  </code></pre>
  
  <p>Is the condition necessary to stop HTML being inserted into the database cache? </p>
  
Tags: <cache>
Title: Is cache condition necessary to stop HTML being inserted into database cache?
ThreadText: # Is cache condition necessary to stop HTML being inserted into database cache?
  
  (Asked by: username_0 on 2016-09-19)
  
  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?
  
  **Tags:** cache
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-09-19. Score: 3 | Accepted answer
  
  No, there is a better way to do this. Set the `enableTemplateCaching` [config value](https://craftcms.com/docs/config-settings#enableTemplateCaching) to false.
  
  ```
  'enableTemplateCaching' => false,
  
  ```
  
  With that setting disabled, all caching will be skipped.
  
  ```
  // Won't be cached
  {% cache for 1 hour %}
  
  ```
  
  
  ---
  
  