arkhi-digital / silverstripe-cloudflare

This module aims to relieve the stress of using CloudFlare caching with any SilverStripe project. Adds extension hooks that clears CloudFlares cache for a specific page when that page is published or unpublished
BSD 3-Clause "New" or "Revised" License
24 stars 9 forks source link

DataObject Support? #36

Open purplespider opened 7 years ago

purplespider commented 7 years ago

Does the module support triggering a purge on the saving on DataObjects? Or just Pages?

e.g. When a new Testimonial DO is added, the related Testimonials Page should be purged. Would also be good to be able to define which other pages/URLs need purging when a Page is edited. e.g. Also purge the Home page when a new News Article page is added (as the Home page lists latest news).

zanderwar commented 7 years ago

It currently only supports Pages. I do see your use case however not all DO's have a relation to a specific page, nor can I see any way of determining what pages they do belong to without that extra static you refer to.

If you have something in mind I would love to see a PR?

purplespider commented 7 years ago

Yeh, it wouldn't be able to automatically detect which other pages/URLs should be purged, but should provide a way to easily specify the details. Was thinking something along the lines of Static Publisher's pagesAffectedByChanges() method.

I'll certainly have a look at implementing this, it may be a little beyond me though.