Disk-based Caching for Binary Large Objects

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.

Enabling and Modifying Disk-based Caching

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:

<BlobCache location="C:\blobCache" 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

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

  4. Click OK.

See Also

Community Additions