<p>That code would still work in Craft 3 and achieve the same thing it did in Craft 2.</p>

CC BY-SA 4.0
2020-03-06T19:58:03.570Z
2020-03-06T19:58:03.570Z
Brad Bell
<p>So in Craft 2 the following code was required to cache bust if an entry was set to pending or post at a future date.</p>

<pre><code>{% set firstPending = craft.entries({
  section: 'projects',
  status: 'pending',
  order: 'postDate asc'
}).first %}
{% set cacheUntil = firstPending ? firstPending.postDate : now|date_modify('+1 year') %}

{% cache globally using key craft.request.path until cacheUntil %}

content
{% endcache %}
</code></pre>

<p>Is this still required in Craft 3 or is there some magic that now happens in the background?</p>

<craft3><cache>
Craft 3 Cache Busting for Pending Entries
# Craft 3 Cache Busting for Pending Entries

(Asked by: username_0 on 2020-03-05)

So in Craft 2 the following code was required to cache bust if an entry was set to pending or post at a future date.
{% set firstPending = craft.entries({
  section: 'projects',
  status: 'pending',
  order: 'postDate asc'
}).first %}
{% set cacheUntil = firstPending ? firstPending.postDate : now|date_modify('+1 year') %}

{% cache globally using key craft.request.path until cacheUntil %}

content
{% endcache %}

Is this still required in Craft 3 or is there some magic that now happens in the background?

**Tags:** craft3, cache


---

## 1 answers

### Answer by username_1 on 2020-03-06. Score: 1 | Accepted answer

That code would still work in Craft 3 and achieve the same thing it did in Craft 2.


---

