I'm using {% cache %} to cache pages, but it seems that the caches are not invalidated after posting new content, which is what I thought should happen.

I've investigated the situation and what I think is happening is this:

  • Post a new entry
  • Caches are then deleted (this process takes a looong time: I noticed that templatecacheelements table was up to something like 450,000 rows)
  • The page in question is accessed by a visitor while the cache is being invalidated, and so the template is cached again before it has been purged

Because Craft doesn't know about the access to the template during emptying of the caches, I suppose it never will until the cache is purged manually.

Is there anything I can do to improve this situation?


1 Answer 1


Not the answer you'd be hoping for but the advice I got was to create a plugin to listen and clear the cache when a new entry was published https://twitter.com/craftcms/status/541968671300911104

  • I think that tweet assumed you were talking about data caches (by default in craft/storage/runtime/cache), not template caches (stored in the database).
    – Brad Bell
    Commented Dec 9, 2014 at 21:54

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.