craftcms / element-api

Create a JSON API/Feed for your elements in Craft.
MIT License
498 stars 57 forks source link

Cache Busting with Sites #79

Closed zmetcalf closed 6 years ago

zmetcalf commented 6 years ago

We have an instance that is using the multi-sites system, and we are using the caching that was just implemented. (Thank you!) However, we are finding that the cache is not busting on update of elements. Is there an update to this plugin's codebase that can be made, do we need to bust the cache with a custom event within a plugin, or something else?

brandonkelly commented 6 years ago

Duplicate of #47

roberttolton commented 6 years ago

Was this resolved? #47 has also been closed.

zmetcalf commented 6 years ago

I ended up just writing the Craft 3 version of this:

craft()->on('elements.onSaveElement', function(Event $event) {
          craft()->cache->flush();
});

I don't think they are interested in doing much more than this.

jorisnoo commented 3 years ago

@zmetcalf May I ask what you ended up using for Craft 3?

zmetcalf commented 3 years ago

Been a long, long time since I did this, but if you are looking for something simple, just create a basic plugin and add that line in the main plugin file. I think the big drawback of this is that it resets cache for everything. You'd need to figure out their cache key system to make it better.