tractorcow / silverstripe-dynamiccache

Simple on the fly caching of dynamic content for Silverstripe
39 stars 27 forks source link

Versioned Data Object Extension #51

Closed nglasl closed 6 years ago

nglasl commented 7 years ago

Rather than purging the cache on after write for a data object, this should probably take versioning into account (or at least have a versioned specific extension available). When a content author is drafting something up and hitting save (on a page for example), you don't want to clear the entire cache.

Not only is this a problem when saving quite frequently, but it's also not necessary when caching is bypassed using the CMS preview to begin with.

tractorcow commented 7 years ago

Hm, so we could segment the cache by stage? I.e. write on stage -> clears stage cache, write on live -> clears live cache. Sounds challenging but a good idea. :)

nglasl commented 7 years ago

I was thinking something a little simpler, more so if the object is versioned, only clear the cache on after publish. I guess it depends on the benefits of caching staged content.

tractorcow commented 7 years ago

Ok, that might be simpler, as long as we disable caching in stage mode.

jonom commented 7 years ago

if the object is versioned, only clear the cache on after publish

You would probably also need to check that the class has a Live stage. You can use Versioned just to track changes by having a single stage, in which case there would not be a publish action.

nglasl commented 6 years ago

Fixed with https://github.com/tractorcow/silverstripe-dynamiccache/pull/59/.