Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Why cache draft content?


Go to End


691 Views

Avatar
svandragt

Community Member, 44 Posts

22 November 2012 at 2:18am

Edited: 22/11/2012 2:19am

What reasons are there for caching draft content by default?

I'm asking this because I've added the following code to mysite/_config.php to restrict caching directives:

// limit caching to test + live environment and "Published stage" only
if (Director::isDev() || Versioned::current_stage() !== 'Live') {
    SS_Cache::set_cache_lifetime('any', -1, 100);
}

It makes sense to me to have that as a default for SilverStripe in general, because this prevents draft caches from showing on the live site by mistake. I've had this happen with draft menu links for example. It seems a more sensible default from my understanding.

Why would it be desirable to have caching enabled in draft stages?