<p>You should give No-Cache a try: <a href="https://plugins.craftcms.com/nocache" rel="nofollow noreferrer">https://plugins.craftcms.com/nocache</a></p>

CC BY-SA 4.0
2020-09-11T10:55:02.323Z
2020-09-11T10:55:02.323Z
Ottó Radics
<p>No you can't, but you might be able to cache each block individually rather than trying to exclude one of them.</p>

CC BY-SA 4.0
2020-09-11T08:59:47.233Z
Agreed. Whenever I need to exclude a portion of code from within a cache tag, I tend to cache the component in chunks, appropriately named.
Martin Spain
CC BY-SA 4.0
2020-09-11T07:12:51.820Z
2020-09-11T07:12:51.820Z
darylknight
<p>Does anybody know, if it is possible to prevent caching from within the cached code/content?</p>
<p>Something like:</p>
<pre><code>{% cache ... %}
...
{% do notCache %}
...
{% endcache %}
</code></pre>
<p>Why? Because if there is a content builder inside of the cache tag, certain content elements could simply disable caching that way by calling  <code>{% do notCache %}</code></p>

<cache>
Prevent caching from inside of the cache tag
# Prevent caching from inside of the cache tag

(Asked by: username_0 on 2020-09-11)

Does anybody know, if it is possible to prevent caching from within the cached code/content?
Something like:
{% cache ... %}
...
{% do notCache %}
...
{% endcache %}

Why? Because if there is a content builder inside of the cache tag, certain content elements could simply disable caching that way by calling  {% do notCache %}

**Tags:** cache


---

## 2 answers

### Answer by username_1 on 2020-09-11. Score: 2

You should give No-Cache a try: <https://plugins.craftcms.com/nocache>


---

### Answer by username_2 on 2020-09-11. Score: 2

No you can't, but you might be able to cache each block individually rather than trying to exclude one of them.

> **Comments:**
> **username_3**: Agreed. Whenever I need to exclude a portion of code from within a cache tag, I tend to cache the component in chunks, appropriately named.  

---

