Answers.Body: <p>That code would still work in Craft 3 and achieve the same thing it did in Craft 2.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-03-06T19:58:03.570Z
Answers.LastActivityDate: 2020-03-06T19:58:03.570Z
Answers.UserDisplayName: Brad Bell
Body: <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>
  
Tags: <craft3><cache>
Title: Craft 3 Cache Busting for Pending Entries
ThreadText: # 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.
  
  
  ---
  
  