<p>Can't think of any clever workarounds, but this is on our 2.2 list to add events so that 3rd party services can be notified when template caches get invalidated.</p>

CC BY-SA 3.0
2016-08-29T20:04:40.993Z
Any update on this? Is this something we should expect in v3?
Trevor Davis
CC BY-SA 3.0
2014-08-16T19:37:30.943Z
I'm going to mark this as the answer for now, and I'll update the question when 2.2 is released. In the meantime, we created a simple plugin that listens for the `onSaveEntry` event and call out to Fastly to purge its entire cache. It's brute force but its simple and works until the cache invalidation event is available.
cmal
CC BY-SA 3.0
2014-08-15T03:58:35.377Z
2014-08-15T03:58:35.377Z
Brad Bell
<p>We're experimenting with using <a href="http://fastly.com" rel="nofollow">Fastly</a> for full-site caching of a Craft site. Everything is working great so far, with the exception that Fastly obviously has no way to know when a URL's cache has been invalidated.</p>

<p>We were thinking that the easiest way to make this work would be to use Craft's built-in caching and create a simple plugin that listens for Craft to invalidate a URL's cache (such as when updating an Entry referenced by that cache) and call out to Fastly to clear its cache for the same URL.</p>

<p>Unfortunately, as far as I can tell, Craft doesn't provide an Event for when it updates its own caches. Am I missing something? Any tips on how to go about this?</p>

CC BY-SA 3.0
2014-08-13T17:08:47.947Z
This actually sounds like a feature request to me. There aren't any [native events](http://buildwithcraft.com/docs/plugins/events-reference) which notify of caching events, though it's reasonable to put in an official feature request for P&T to add them. I can't think of a non-events based way to handle this, but we'll leave this question open a little longer in case anyone comes up with a good workaround.
Lindsey D
CC BY-SA 3.0
2014-08-13T17:12:37.147Z
I don't know of any clever workarounds, but this is on our 2.2 list to add events so that 3rd party services can be notified when template caches get invalidated.
Brad Bell
CC BY-SA 3.0
2014-08-14T18:28:34.723Z
Thanks Lindsey and Brad. I'll just look forward to 2.2 and figure out another solution to this for now.
cmal
<caching>
How to clear a third-party cache when Craft updates its own template caches
# How to clear a third-party cache when Craft updates its own template caches

(Asked by: username_0 on 2014-08-13)

We're experimenting with using [Fastly](http://fastly.com) for full-site caching of a Craft site. Everything is working great so far, with the exception that Fastly obviously has no way to know when a URL's cache has been invalidated.

We were thinking that the easiest way to make this work would be to use Craft's built-in caching and create a simple plugin that listens for Craft to invalidate a URL's cache (such as when updating an Entry referenced by that cache) and call out to Fastly to clear its cache for the same URL.

Unfortunately, as far as I can tell, Craft doesn't provide an Event for when it updates its own caches. Am I missing something? Any tips on how to go about this?

**Tags:** caching

> **Comments:**
> **username_1**: This actually sounds like a feature request to me. There aren't any [native events](http://buildwithcraft.com/docs/plugins/events-reference) which notify of caching events, though it's reasonable to put in an official feature request for P&T to add them. I can't think of a non-events based way to handle this, but we'll leave this question open a little longer in case anyone comes up with a good workaround.  
> **username_2**: I don't know of any clever workarounds, but this is on our 2.2 list to add events so that 3rd party services can be notified when template caches get invalidated.  
> **username_0**: Thanks Lindsey and Brad. I'll just look forward to 2.2 and figure out another solution to this for now.  

---

## 1 answers

### Answer by username_2 on 2014-08-15. Score: 1 | Accepted answer

Can't think of any clever workarounds, but this is on our 2.2 list to add events so that 3rd party services can be notified when template caches get invalidated.

> **Comments:**
> **username_0**: I'm going to mark this as the answer for now, and I'll update the question when 2.2 is released. In the meantime, we created a simple plugin that listens for the `onSaveEntry` event and call out to Fastly to purge its entire cache. It's brute force but its simple and works until the cache invalidation event is available.  
> **username_3**: Any update on this? Is this something we should expect in v3?  

---

