In a normal operation, SharePoint generates ASP.NET pages dynamically from page templates and database content. These ASP.NET pages are then converted into HTML and sent to the client browser. This is a resource-intensive process. Page output caching stores the HTML output for specific SharePoint pages in memory, so that SharePoint does not need to regenerate a commonly-requested page every time.
In addition, the page output cache can also store various versions of the same page. For example, anonymous users and authenticated users may see various versions of a specific page. SharePoint is able to cache both versions so requests from either type of user can be served without regenerating the page. Page output caching in SharePoint applies only to publishing pages. You configure page output caching at the site collection level through the Site Settings menu. The page output caching settings are only available if:
- The SharePoint Server Publishing Infrastructure site collection-level feature is enabled.
- The SharePoint Server Publishing site-level feature is enabled.
When it ideal to use page output cache
Page output caching can improve the speed at which commonly-requested pages are served and it can reduce the resource overhead associated with generating a page from database content. However, it does create a memory overhead on WFE servers, because cached pages are stored in memory. Generally speaking, page output caching is more suitable for publishing sites in which many users are likely to see the same content. There is little benefit to enabling page output caching on sites where the user experience is heavily individualized.
Page output cache profiles
You configure page output caching through cache profiles. Cache profiles specify the criteria used to perform caching, such as the retention period, whether items in the cache should be security trimmed and whether various page versions should be cached for specific parameters, HTTP headers, or query strings. When you enable page output caching, you select the cache profile you want to use for that site collection, site, or page layout. You can specify different cache profiles for anonymous and authenticated users.
Use the following procedure to create a new cache profile:
- On the root site for your SharePoint site collection, on the Settings menu, click Site settings.
- On the Site Settings page, under Site Collection Administration, click Site collection cache profiles.
- On the Cache Profiles page, click new item.
- Specify the criteria for you cache profile and then click Save.
Enabling page output caching
You can configure page output caching at the site collection level, the site level, or the page layout level.
The site collection-level settings specify default caching settings for the entire site collection. You can then override these settings where required at the site level or the page layout level.
Use the following procedure to configure page output caching at the site collection level:
- On the Settings menu, click Site settings.
- On the Site Settings page, under Site Collection Administration, click Site collection output cache.
- On the Output Cache Settings page, select Enable output cache.
- Under Default Page Output Cache Profile, on the Anonymous Cache Profile and Authenticated Cache Profile drop-down lists, click the required cache profile (or click Disabled).
- If you want individual sites to be able to override the default cache profile, under Page Output Cache Policy, click Publishing sites can use a different page output cache profile.
- If you want individual page layouts to be able to override the default cache profile, under Page Output Cache Policy, click Page layouts can use a different page output cache profile.
- If you want to include caching details on the SharePoint Developer Dashboard, under Debug Cache Information, click Enable debug cache information on pages.
- Click OK.
Configuring page output caching at the site level
Use the following procedure to configure page output caching at the site level:
- On the Site Settings page, under Site Administration, click Site output cache.
- On the Published Site Output Cache Settings page, under Anonymous Cache Profile, choose whether to inherit the default site collection cache profile or select a different cache profile.
- On the Published Site Output Cache Settings page, under Authenticated Cache Profile, choose whether to inherit the default site collection cache profile or select a different cache profile.
- Click OK.
Configuring page output caching at the page layout level
Use the following procedure to configure page output caching for individual page layouts:
- On the Site Settings page, under Web Designer Galleries, click Master pages and page layouts.
- On the Master Page Gallery page, locate the page layout you want to configure and then on the drop-down menu, click Edit Properties.
- In the Authenticated Cache Profile drop-down box, click the cache profile you want to use.
- In the Anonymous Cache Profile drop-down box, click the cache profile you want to use.
- Click Save.