Object Caching

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.

Cross-List Query Caching

The cross-list query cache calls the site (SPWeb) and searches for items in one or more lists. The results of the query are cached, and data from multiple list sources is returned. Caching improves the query's performance.

You can extend cross-list query caching only by passing custom properties to the VaryByCustom event handler. To learn more, see the How to: Extend Caching by Using the VaryByCustom Event Handler topic.

The Content Query Web Part uses cross-list query caching to improve its speed and performance. When you cache a cross-list query, no database round trip is required to retrieve results for a Content Query Web Part. You can use cross-list query caching across sites in a site collection, and the caching system retrieves and caches an optimum set of query results for each query. Additionally, the cache configuration includes enough metadata to dynamically trim for security each time a page is executed.

You can almost always cache results of a cross-list query. However, when a checked-out document is queried, data retrieved from that document bypasses the caching mechanism; that data is not cached until the document is checked in.

A cross-list query configuration is expressed in the form of a row multiplier. The query can be time-based or change-based.

Note

Office SharePoint Server 2007 does not have a Web user interface (UI) to flush the object cache on all servers. You can use the stsadmin command to flush all binary large object (BLOB) caches associated with a specified Web application on different Web front-end computers on the farm: stsadm -o setproperty -propertyname blobcacheflushcount -propertyvalue 11 -url http://mywebapp:port where mywebapp:port is the server name and port number of the Web application that you want to flush the BLOB cache for.

Procedures

Configure the object cache

  1. On the Site Actions menu, point to Site Settings, and then click Modify All Site Settings.

  2. Under Site Collection Administration, click Site collection object cache.

  3. 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.

  4. 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

  5. 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.

  6. Click OK.

Flush the object cache

  1. On the Site Actions menu, point to Site Settings, and then click Modify All Site Settings.

  2. Under Site Collection Administration, click Site collection object cache.

  3. 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.

  4. Click OK.

See Also

Tasks

How to: Customize the Content Query Web Part by using Custom Properties
How to: Deploy Content Between Servers

Concepts

Custom Caching Overview
Output Caching and Cache Profiles
Disk-based Caching for Binary Large Objects