Reputation: 353
By default, it looks like Sitecore does not cache pages. In web.config, set this
<setting name="DisableBrowserCaching" value="false"/>
and create pipeline processor
page.Response.Cache.SetExpires(DateTime.Now.AddSeconds(60));
page.Response.Cache.SetCacheability(HttpCacheability.Public);
but it did not work, the response head stays no-cache
. By the way, I add the pipeline in the renderLayout
, anyone knows? thanks!
Upvotes: 3
Views: 5406
Reputation: 46
Sitecore has 7 layers of caching before the content is rendered as HTML. You can control the caching on every before the contents is rendered. But it's true that no-cache is true by default.
This is because pages in Sitecore are dynamic. They change layout and contents depending on the current situation. Expecially if you use devices ( http://briancaos.wordpress.com/2012/04/12/identifying-mobile-devices-in-sitecore/ ) and when using the Sitecore DMS, content is rendered differently for each devices and user.
If you build your own browser-caching mechanisms, please be sure that you only do this on pages with static content.
Upvotes: 1
Reputation: 8877
I have tried to reproduce this by first setting the DisableBrowserCaching
setting to true
. This will indeed produce a no-cache header.
Then i've set it to false
and reloaded the page and the no-cache header disappeared. There was no need for anything else.
If you want to set expiry headers, you should do this in IIS, in the HTTP Response Headers feature.
Upvotes: 3