2

We're experimenting with using Fastly 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?

3
  • This actually sounds like a feature request to me. There aren't any native events 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
    Aug 13, 2014 at 17:08
  • 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.
    – Brad Bell
    Aug 13, 2014 at 17:12
  • Thanks Lindsey and Brad. I'll just look forward to 2.2 and figure out another solution to this for now.
    – cmal
    Aug 14, 2014 at 18:28

1 Answer 1

1

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.

2
  • 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
    Aug 16, 2014 at 19:37
  • Any update on this? Is this something we should expect in v3? Aug 29, 2016 at 20:04

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.