sathoro / Stow

Craft CMS plugin for caching page fragments
29 stars 0 forks source link

Feature request: flush cache on Global set update #1

Open hellonicolas opened 10 years ago

hellonicolas commented 10 years ago

Hi there! It took me some tweaking, but I think I finally figured out how to use Stow.

In addition to Entry/Entries, it'd be great if updating a Global set (or sets!) could also trigger flushing the cache.

Not sure if Craft makes it possible to do this with Globals, but I figured I'd ask :) Thanks!

sathoro commented 10 years ago

I will be including this shortly, stay tuned

hellonicolas commented 10 years ago

Awesome, thanks! I ended up hacking into the plugin quite a bit to get some stuff working for my current setup – like adding some methods to clear out caching and even the option to store the caches as static JSON files (instead of in the DB).

I also added a Craft Event listener in a custom plugin (that handles other site-specific things for me) that wipes out the Stow cache on these events:

In my specific use-case, the most convenient method was to just wipe it all out anytime content is updated.

I'd be happy to share the code if you're interested, but I can't guarantee it's pretty ;)