Return to doc.sitecore.com

Valid for Sitecore 5.2, 5.1.1
2.  Cache
Prev Next

In Sitecore 5.1 we go from having one large cache (mapping to the ASP.NET cache) to using multiple custom caches.

The caches are all accessed through a common class, the CacheManager. This class has a lot of methods used for adding/removing data and performing other cache related functions.

2.1.  Database caches

The credential cache stores information about user rights. For instance, when it has been determined that a specific user can or can not read a given item, this information is stored in the credential cache. Subsequent read requests can then be granted without requiring a full security scan for the user again.

The data cache stores data read from the data provider(s). The data is stored in a format that makes it very fast to access. Specifically, the cache contains objects of the type DataManager.DataContainer.

The path mapping cache stores information about previously resolved paths. For instance, if the system has already determined that the path "/sitecore/content/home" maps to the ID {110D559F-DEA5-42EA-9C1C-8A5DF7E70EF9} it stores this information. The next time someone requests an item using the same path, the item can be retrieved very fast using the cached ID.

2.2.  Site caches

The html cache stores the html output of renderings that have been set to Cacheable.

The xsl cache is used for storing compiled XSLT files in memory. This relieves the system from the need to recompile the XSLT's every time they are needed. Also, it helps keep memory consumption down when using inline code in XSLT's (as these can not be unloaded due to a limitation in .Net).

The registry cache is used by the Sitecore Client to store various user settings and would not normally be used by other applications.

The viewState cache is also an interal cache used by the Sitecore Client.

2.3.  Cache Sizes

For detailed information concerning the cache sizing, please refer to the Cache Sizing article.

2.4.  Disabling cache

By settting a size of 0 (zero) on a cache, the cache in question will be disabled. For instance, to disable html caching on the web site: 

  <site name="website"    ...   htmlCache="0" />  

To disable all caching whatsoever in the system, the global setting "Caching.Enabled" can be used like this: 

  <setting name="Caching.Enabled" value="false" />

This setting is mostly for diagnostic purposes.

As a side note, individual data providers may also prevent their data from being cached by using the CacheOptions property on the DataProvider base class. For an example of this, see the file system data provider, which is defined like this in web.config:

<filesystem type="Sitecore.Data.DataProviders.FileSystemDataProvider,  Sitecore.Kernel">
  
<CacheOptions.DisableAll>true</CacheOptions.DisableAll>
</filesystem>

Prev Next