Kentico CMS 6.0 Developer's Guide

Caching options

Caching options

Previous topic Next topic Mail us feedback on this topic!  

Caching options

Previous topic Next topic JavaScript is required for the print function Mail us feedback on this topic!  

Global caching settings


Go to CMS Site Manager -> Settings -> System -> Performance and either choose your website from the drop-down list or choose (global) to configure global settings inheritable by all websites. The following values are related to caching:


Server content caching

Cache page info (minutes)

Number of minutes the page information should be cached for. This option is used for caching of page content and metadata. Since Kentico CMS often retrieves page information many times during the processing of a single page, it's actually a must to always set this value to at least 10 minutes! Kentico CMS automatically removes the cached page when it's modified, so it doesn't cause outdated content to be displayed.

Cache content (minutes)

Number of minutes content should be cached for. This option specifies that all web parts/controls should cache the content that they retrieve from Kentico CMS. You can override this value by setting the Cache minutes property of web parts to 0, which disables caching for the given control, or generally to some different number of minutes. It's recommended that you cache all possible content that is not modified too often. The drawback of this option is that when you modify some content, the changes appear on the live site only after the old version expires in the cache.

Server file caching

Cache images (minutes)

This option is used only for caching of images and sets the number of minutes that the images should be cached for. It's recommended that you always use it. Kentico CMS automatically removes a cached image when it's modified, so it doesn't cause displaying of outdated content.

Maximum file size to cache

Specifies the maximum size of a file in kilobytes that is allowed to be cached.

Redirect files to disk

If checked, file requests are redirected to the corresponding physical file in the file system if possible.

Client caching

Client cache (minutes)

Number of minutes for which content can be cached in the client browser. If the value is set to 0, client caching is disabled.

Client cache must revalidate

If enabled, content that is cached in the client browser must be revalidated by calling the server. If disabled, the browser will not have to perform server requests if the requested content is already cached.

Output caching

Enable output caching

If checked, the output caching is enabled. If unchecked, no output caching is allowed on the whole site. The document settings still apply, both this settings and document settings must be enabled to use output cache.

Cache output in file system (minutes)

Specifies the amount of time for which the output cache should be stored in the file system to provide persistent cache storage on application restart. If not set, standard caching mechanism in memory is used. If set, the system checks both caches.

Enable partial caching

If checked, the partial caching of web parts is enabled. If unchecked, no partial caching is allowed on the whole site. The web part settings still apply, both this settings and web part settings must be enabled to use partial cache.


Full-page caching


Full-page caching represents the most powerful option. It caches the whole page, so it's not necessary to contact the SQL Server and run the page code again when the page is requested a second time. To use it, you first need to adjust the Output caching settings mentioned above. Then you can configure full-page caching in CMS Desk -> Properties -> General. The configuration is automatically inherited by child pages unless you disable caching on them.


This option is not suitable for pages with web parts that need to be refreshed very often (e.g. the Random document web part) since you cannot disable caching for particular web parts. For such pages, it's recommended that you do not use full-page caching and use content caching instead.


The page stored in the cache is automatically removed when you modify the given page. However, if the page displays other documents (such as a news list) and you modify these documents, the page will not be updated. Another way of removing the page from the cache is clicking the Clear output cache button on the Properties -> General tab.


It is also possible to define custom dependencies for the output cache of a page using the Output cache dependencies web part.


Web part/control-level caching settings


Some web parts/controls used for displaying content have three properties related to caching:


Cache item name/CacheItemName - this property specifies the key name under which the content will be stored in the cache. If not specified, the system generates the key name automatically based on the site name, page path, web part ID and current user name.


Cache minutes/CacheMinutes - this property specifies for how long the web part should cache the content it retrieves from Kentico CMS. The default value is defined in the Cache content (minutes) site settings value described above. You can override the global value by setting this property to a different number.

Cache dependencies/CacheDependencies - using this property, you can specify which object changes cause the web part's cache to get cleared. Below, you can find a table showing which dummy cache keys get touched when some object gets changed, including some examples. By entering the appropriate dummy keys, one per line, you can specify that when the object gets changed, the cache gets cleared.


If you check the Use default cache dependencies check-box, default settings will be used. The default settings are configured for each web part and include all possible object changes that the content of the web part could depend on.



Touched keys

Sample values








+ for every parent node:









Any object

(except documents)








cms.user|byguid|1ced44f3-f2fc- ...



metafile|1ced44f3-f2fc- ...

Document attachment


attachment|1ced44f3-f2fc- ...

Forum attachment


forumattachment|1ced44f3-f2fc- ...



avatarfile|1ced44f3-f2fc- ...

Media file



mediafile|1ced44f3-f2fc- ...

mediafile|preview|1ced44f3-f2fc- ...

Page template








Example 1: let's presume that you have a web part displaying some information about users. Therefore, whenever some user gets its details modified, the web part's cache should be cleared. To ensure this, you need to enter cms.user|all into the field, which is the dummy key that would get touched whenever some user's details get changed.


Example 2: now let's presume that your web part is displaying information about one particular user - the administrator. Her user name is administrator, her ID is 53 and her GUID is something beginning with 1ced44f3-f2fc. So if you want to have the cache cleared whenever this user's details are changed, you can use any of the following three keys that specify the user by the previously named properties:






Partial caching


Partial caching is, simply put, full-page caching for web parts. Like with full-page caching, partial caching also stores the output HTML code. But in this case, it doesn't store the whole page, but only the output HTML code of the particular web part. The web parts have the Partial cache minutes and Partial cache dependencies properties, which can be used the same way as the Cache minutes and Cache dependencies properties described above.


Please note: default partial cache dependencies are not specified for the web parts, so if you want to use this feature, you need to specify them manually by entering the dummy keys as described above.


Caching and personalization


If your website contains sections for site members, the caching will be personalized, which means each signed in user will have their own cache. This may lead to large memory consumption, so it's recommended that you set caching to lower values for membership sites.


Previewing modifications made to pages with caching


Caching may confuse the content editors since they will not see the changes they made on the live site immediately. In such case, they can preview their changes in the Preview mode in Kentico CMS Desk since this mode doesn't use caching. The Edit mode doesn't use caching either.