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

{% endcache %}

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

1 Answer 1


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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.