<p>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 <a href="https://twitter.com/craftcms/status/541968671300911104" rel="nofollow">https://twitter.com/craftcms/status/541968671300911104</a></p>

CC BY-SA 3.0
2014-12-09T21:54:13.567Z
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
CC BY-SA 3.0
2014-12-09T21:29:01.187Z
2014-12-09T21:29:01.187Z
Steven Grant
<p>I'm using <code>{% cache %}</code> to cache pages, but it seems that the caches are not invalidated after posting new content, which is what I thought should happen.</p>

<p>I've investigated the situation and what I think is happening is this:</p>

<ul>
<li>Post a new entry</li>
<li>Caches are then deleted (this process takes a looong time: I noticed that templatecacheelements table was up to something like 450,000 rows)</li>
<li>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</li>
</ul>

<p>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.</p>

<p>Is there anything I can do to improve this situation?</p>

CC BY-SA 3.0
2014-12-09T21:28:15.877Z
Possible duplicate?  See answer here: http://craftcms.stackexchange.com/a/2071/57
Brad Bell
<cache>
Cache not invalidated on publishing new entry
# Cache not invalidated on publishing new entry

(Asked by: username_0 on 2014-12-09)

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?

**Tags:** cache

> **Comments:**
> **username_1**: Possible duplicate?  See answer here: http://craftcms.stackexchange.com/a/2071/57  

---

## 1 answers

### Answer by username_2 on 2014-12-09. Score: 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>

> **Comments:**
> **username_1**: 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).  

---

