SharePoint 2007 has a caching features built into itself to speed up the performance of site rendering, but does not do content synching or content replication. MOSS 2007 uses ASP.NET 2.0 caching options as well as caching functionality that the Office team designed specifically for MOSS.
The types of caching are:
Type: Output Caching and Cache Profiles
Cache At: Individual page level
Note: Includes extending caching using VaryByCustomString
Type: Object Caching
Cache At: Individual Web Part control, field control, and content level
Note: Includes cross-list query caching and navigation caching
Type: Disk-based Caching for Binary Large Objects
Cache At: Individual binary large object (BLOB) level and caches images, sound, movies, and code
Note: Supports .gif, .jpg, .js, .css, and other image, sound, and code files that are stored as binary large objects
Procedures for Output Caching and Cache Profiles
Pros and Cons of Output Caching
Before choosing to use output caching to improve the performance of page and page-item rendering, consider benefits and drawbacks of a potential output caching implementation. All considerations are not listed in this document, but some benefits you may want to consider include:
Each equivalent class of content (such as page or item within a page) receives faster response, and therefore shorter latency, after it is initially rendered.
Each server uses less CPU time and energy to serve the same page after the initial rendering.
Each data source for the rendered page can scale to serve more Web clients because of the decreased traffic flow that output caching makes possible.
For each page request for which an output cached version of a page is served, the server does not have to:
Make a round trip to the database to fetch the source code for the .aspx page and any .ascx controls on the page.
Reload and re-render the controls.
Requery any data sources that the controls rely on for data.
However, before deciding to implement output caching, you may want to consider the following concerns:
Output caching consumes additional memory. Each version of a page consumes memory on the Web client.
When used with two or more front-end Web servers, output caching may affect consistency. You can configure a cache profile not to check for updates for each request and, for example, instruct it to ignore changes to the version of the Web page in the output cache until 60 seconds after the original page is updated. If you have two front-end Web servers in your topology, and depending on the load balancer used to route the user's request, a reader of site content could see inconsistency if the page is rendered by one server and then a subsequent request is routed to a second server within that 60-second window.
Cache Profiles
Office SharePoint Server 2007 adds a more precise mechanism for customizing output caching than those available natively in ASP.NET 2.0. Office SharePoint Server 2007 includes cache profiles, which are list-style cache settings that you can name and apply to pages, page items, content types, and levels of scale in your site deployment.
By using cache profiles, you can control the level of granularity applied to output caching; allow or disallow site owners and administrators to choose their own cache profiles and apply them flexibly to page layouts; and target output caching at the site collection, site, and page layout levels.
You can organize caching behavior based on a user's access rights to a site. For example, you may have three groups defined: one with full control, one with read and write rights, and one with read-only rights. Output caching renders the page the same way for users with the same rights, so you can use cache profiles to target caching to specific audience groups. In the cache profiles that Office SharePoint Server 2007 delivers by default, the caching system renders the page once per group of user access rights and then caches the resulting HTML stream. The next user with the same access rights gets the stream from the cache.
After you create and deploy a cache profile, any change to the cache profile immediately affects all applicable content on the site. For example, if all document library page layouts in a given site collection are initially cached for 60 seconds, and you increase that duration to 120 seconds, every document library page layout in that site collection is cached for 120 seconds regardless of the number of document library page layouts or sites in the site collection.
You can define a cache profile by using the cache profile stored in a standard Office SharePoint Server 2007 list, and extend it programmatically by using a VaryByCustom handler. If you apply the cache profile to the site and page layout through the user interface, down-level propagation enforces consistency in child sites. Cache policy is secured independently from other Office SharePoint Server 2007 features.
To enable output caching for a site collection
Navigate to the root Web site of the site collection. On the Site Actions menu, click Site Settings.
In the Site Collection Administration section, select Site collection output cache.
To enable output caching for this site collection, select Enable output cache.
Choose a cache profile for anonymous users from the Anonymous Cache Profile list. This profile is applied when anonymous users access a site in this site collection.
Choose a cache profile for authenticated users from the Authenticated Cache Profile list. This profile is applied when authenticated users access a site in this site collection.
Choose Page Output Cache Policy options.
If publishing sites can use a different output cache profile, select Publishing sites can use a different page output cache profile.
If page layouts can use a different output cache profile, select Page layouts can use a different page output cache profile.
If you want to display additional cache information on pages in this site collection, including the date and time that page contents were last rendered, select Enable debug cache information on pages.
Click OK.
To enable output caching for a site
Navigate to the root Web site of the site collection. On the Site Actions menu, click Site Settings.
In the Site Administration section, select Site output cache.
Choose an Anonymous Cache Profile option:
If you want to inherit a cache profile, click Inherit the profile.
If you want to choose a cache profile from those currently available, select Select a page output cache profile.
If you want to apply these settings to all subsites of this root Web site, select Apply these settings to all sub-sites.
Click OK.
To create a new cache profile
Navigate to the root Web site of the site collection. On the Site Actions menu, click Site Settings.
In the Site Collection Administration section, select Site collection cache profiles.
Click New.
Define and create a new cache profile.
| Detail |
Description |
|
Title
|
Required. The system name of this cache profile.
|
|
Display Name
|
Populates the list of available cache profiles for site owners and page layout owners.
|
|
Display Description
|
Populates the list of available cache profiles for site owners and page layout owners.
|
|
Perform ACL Check
|
Select to ensure that all items in the cache are security trimmed.
|
|
Enabled
|
Select if you want caching to happen.
|
|
Duration
|
Number of seconds to keep the cached version available.
|
|
Check for Changes
|
Select to validate on each page request that the site has not changed and to flush the cache when the site changes.
Clear if you want better performance. If unchecked, system does not check for updates to sites for the number of seconds specified in Duration.
|
|
Vary by Custom Parameter
|
Specify a value as described in the ASP.NET 2.0 HttpCachePolicy.SetVaryByCustom method documentation.
|
|
Vary by HTTP Header
|
Specify a value as described in the ASP.NET 2.0 HttpCachePolicy.VaryByHeaders property documentation.
|
|
Vary by Query String Parameters
|
Specify a value as described in the ASP.NET 2.0 HttpCachePolicy.VaryByParams property documentation.
|
|
Vary by User Rights
|
Select to ensure that users must have identical effective rights on all SharePoint security scopes to see the same cached page as any other user.
|
|
Cacheability
|
Choose a value from the drop-down list. Choices include NoCache, Private, Server, ServerAndNoCache, Public, and ServerAndPrivate. To learn more, see the ASP.NET 2.0 HttpCacheability enumeration topic.
|
|
Safe for Authenticated Use
|
Select only for policies that you want to allow administrators and page layout designers to apply to authenticated scenarios.
|
|
Allow writers to view cached content
|
Select to bypass the default behavior of not allowing people with edit rights to cached their pages.
|
Procedures for Object Cache
Microsoft Office SharePoint Server 2007 supports caching of certain page items, such as navigation data and data accessed through cross-list queries. Caching page items is fast and eliminates the need to retrieve field data from the database each time a page is rendered. The caching system caches complete field data for a page, excluding data for any Web Part controls on the page.
Caching for objects in a page can almost always be used. When users have a document checked out, the cache is bypassed.
Configure the object cache
On the Site Actions menu, point to Site Settings, and then click Modify All Site Settings.
Under Site Collection Administration, click Site collection object cache.
In the Object Cache Size section, type a value in the box to specify the amount of memory (in megabytes) that you want the object cache to use.
In the Cross List Query Cache Changes section, select one of the following options:
If your content changes frequently and you want to display the most accurate results possible, select Check the server for changes every time a cross list query runs.
On site collections where the improved performance you get from caching does not compromise the accuracy of the results, select Use the cached result of a cross list query for this many seconds and type the amount of time in seconds to cache the results of the query
In the Cross List Query Results Multiplier section, type a number from 1 through 10 to use as a results multiplier.
Type a larger number if your site collection has unique security permissions applied to many lists and sites. Type a smaller number if your site collection does not have unique permissions on each list or site. A smaller multiplier uses less memory per query.
Click OK.
Flush the object cache
On the Site Actions menu, point to Site Settings, and then click Modify All Site Settings.
Under Site Collection Administration, click Site collection object cache.
In the Object Cache Reset section, do one or more of the following:
To force the current server to flush its object cache, select the Object Cache Flush check box.
Select one or more check boxes. When you click OK, all entries in the object cache are flushed immediately.
If you do not select one more check boxes, the object cache manages the expiration of items based on when they time-out or are changed in the site.
Click OK.
Enabling and Modifying Disk-based Caching
Disk-based caching controls caching for binary large objects (BLOBs) such as image, sound, and video files, as well as code fragments. Disk-based caching is extremely fast and eliminates the need for database round trips. BLOBs are retrieved from the database once and stored on the Web client. Further requests are served from the cache and trimmed based on security.
Disk-based caching is disabled by default. To enable and customize the disk-based cache, you must modify the following statement in the web.config file for the SharePoint Web application mapped to the Internet Information Services (IIS) Web site:
Copy Code
<BlobCache location="C:lobCache" path=".(gif|jpg|png|css|js)$" maxSize="10" max-age="86400" enabled="false"/>
In the preceding example:
location is the directory where the cached files will be stored
path specifies in the form of a regular expression which files are cached based on the file extension
maxSize is the maximum allowable size of the disk-based cache in gigabytes
max-age specifies the maximum amount of time in seconds that the client browser caches BLOBs downloaded to the client computer. If the downloaded items have not expired since the last download, the same items are not re-requested when the page is requested. The max-age attribute is set by default to 86400 seconds (that is, 24 hours), but it can be set to a time period of 0 or greater.
enabled is a Boolean that disables or enables the cache
Flushing the Disk-based Cache
On the Site Actions menu, point to Site Settings, and then click Modify All Site Settings.
Under Site Collection Administration, click Site collection object cache.
In the Disk Based Cache Reset section, do one or more of the following:
To force the server to reset its disk-based cache, select Force this server to reset its disk based cache.
To force all servers to reset their disk-based caches, select Force all servers in the farm to reset their disk based cache.
If you select one or more of the check boxes, all entries in the disk caches are flushed immediately when you click OK. If you do not select any of the check boxes, the disk caches are left unchanged and item expiration is managed, with items being removed when they are changed in the site or when the disk size is exceeded.
Click OK.
I thought it would be easier having all the different types of caching for MOSS available in one place. 