Reference - Cache settings

Global settings

You can configure the following cache settings through the Settings application, in the System -> Performance category:

Server content caching

Cache page info (minutes)

Sets the number of minutes for which the system caches page information (basic page properties and metadata). Kentico retrieves page information many times during the processing of a single page, so always set this value to at least 10 minutes.

When a page is modified, the system automatically clears the corresponding part of the page info cache. This type of caching cannot cause the website to display outdated information.

Cache content (minutes)

Sets the number of minutes for which web parts/controls with data sources cache their content (typically retrieved from the Kentico database).

You can override this value for specific web part instances by setting their Cache minutes property. Using 0 as the value disables content caching for the given web part instance.

It is recommended to cache all possible content. You can use cache dependencies to clear the cache on content changes. For most non-custom data sources, the default dependencies automatically ensure that web parts reload the cached content whenever the data is modified.

See also: Caching the data of page components

Use progressive caching

If checked, the system optimizes access to uncached data so that concurrent threads only use a single data access operation and share the results. This leads to better performance if the website is under a heavy load, without the drawback of not having the latest data available.

Server file caching

Cache files (minutes)

Sets the number of minutes for which the system caches images and other files on the server. Includes images, and web resources such as CSS stylesheets and JavaScript files.

The system automatically removes files from the cache if they are modified, so file caching cannot cause the website to display outdated content.

This setting also specifies the caching interval for Azure CDN, unless overwritten by the CMSAzureCDNCacheMinutes web.config key (see Reference - Web.config application keys for details).

See also: Caching files and resources

Maximum file size to cache

Limits caching of files whose size is greater than the specified number of kilobytes. Files larger than the specified value are only cached for 1 minute, regardless of the Cache files (minutes) setting.

Redirect files to disk

If enabled, the system redirects file requests for page attachments and content tree files to the corresponding physical file (if the requested file is stored in the file system).

Warning: The system stores files on the file system with GUID identifiers instead of names (to avoid conflicts). If you enable the Redirect files to disk setting, files downloaded by users have names in the GUID identifier format instead of the original file name.

Client caching

Client cache (minutes)

Sets the number of minutes for which clients consider cached files to be valid and up-to-date (i.e. the length of the client cache expiration time). Specifically, the setting determines how the server sets the Expires response header for file requests. Client file caching includes images and web resources such as CSS stylesheets.

The following values are possible:

  • 0 - cached files are always flagged as expired, so clients revalidate files on each request. Does NOT disable client caching for files.
  • More than 0 - until a cached file expires, clients load the file’s data from the cache without sending any requests to the server. Provides the best file performance, but may cause browsers to display outdated content (if cached files are modified before the expiration interval ends).

This setting only applies to dynamic files that are managed by the Kentico application, such as stylesheets in the CSS stylesheets application. Files stored on the file system may use a different client cache expiration time. For example, physical files served by the Kentico application through the GetResource.ashx handler use the CMSPhysicalFilesCacheMinutes web.config key (the default value is one week) and directly requested files use the IIS client cache configuration.

See also: Caching files and resources

Allow client cache revalidation

If enabled, the server adds the must-revalidate directive to the Cache-control response header of file requests. Ensures that caching clients always perform revalidation when requesting expired files (most clients revalidate by default even without the must-revalidate directive).

Output caching

Enable output caching

If enabled, the system allows output caching. Output cache stores the full HTML source of pages. If disabled, output caching is off on the whole website.

To enable output caching for pages, configure the Output cache properties of individual pages in the Pages application on the Properties -> General tab. Both the main website setting and page settings must be enabled to use output caching.

See also: Caching page output

Cache output in file system (minutes)

Specifies the number of minutes for which the system stores output cache in the file system. This provides persistent cache storage in case of application restarts.

If not set, only the standard caching mechanism (in memory) is used. If you enter a value, the system loads the output data of requested pages from the file system cache when it is not found in the memory cache.

To enable output caching in the file system for pages, configure the Allow file system cache property of individual pages in the Pages application on the Properties -> General tab.

Warning: Enabling the file system output cache may cause your website to serve outdated content. When clearing invalid output cache due to changes made to pages or other dependencies, the system only removes cache files if the corresponding cache item also exists in the memory. The file system cache remains outdated if the memory cache is not available when the invalidation occurs (for example after an application restart or if you have different expiration times set for the two caching types).

Output cache variables

Determines under which conditions the system stores multiple versions of the output cache for pages. Click Edit to change the default settings.

For example, the username variable ensures that the system stores a separate version of each page’s output cache for every logged in user. If disabled, the output cache does not distinguish between users — if a page’s output is cached for one user, the system may load the same content for all other users (depending on the remaining output cache variables).

You can enable or disable separate output cache for:

  • username - every logged in user (public users share the same output cache).
  • sitename - every site in the system (leave checked unless your sites all have identical content on pages with the same path).
  • lang - each language version of pages.
  • browser - different types of web browsers.
  • cookielevel - the cookie level preferences of visitors.
  • deviceprofile - the device profiles detected for visitors.
  • domain - the website domain name (check to disable output cache sharing between different domain aliases of sites).
  • viewmode - the page view modes used by Kentico, such as design, edit, preview or live site. Currently, the system only uses caching for the live site view mode.

The output cache always creates separate cache items based on the:

  • Page path (including the virtual directory and extension)
  • Protocol in the request URL

Enable partial caching

If enabled, the system allows partial caching of web parts. The partial cache stores the HTML output of individual web part instances. If not checked, partial caching is disabled on the whole website for all web parts.

By default, web parts do not use partial caching. You need to enable partial caching for individual web part instances using the Partial cache minutes property.

See also: Caching portions of the page output

Partial cache variables

Determines under which conditions the system stores multiple versions of the partial cache for web parts. Applies globally to the partial cache of all web parts.

Click Edit to change the default settings.

For example, the lang variable ensures that each web part instance has a separate version of the partial cache for every language. If disabled, the partial cache does not distinguish between languages — if a web part’s output is cached for one language, the system loads the same content for all languages (depending on the remaining partial cache variables).

You can enable or disable separate partial cache for:

  • username - every logged in user (public users always share the same partial cache).
  • sitename - every site in the system (leave checked unless your sites have identical content).
  • lang - each language version of pages.
  • browser - different types of web browsers.
  • viewmode - the page view modes used by Kentico, such as design, edit, preview or live site. Currently, the system only uses caching for the live site view mode.

Page settings

You can configure the following output cache settings for individual pages in the Pages application on the Properties -> General tab:

Output cache

Use output cache

Indicates if the system caches the full HTML output of the page. Output caching can greatly improve the performance of the page, but is not suitable for pages with dynamic content.

You can inherit the output cache settings from the parent page.

Important: Output caching must also be allowed in the website’s settings. Administrators can enable output caching in Settings -> System -> Performance.

See also: Caching page output

Cache minutes

Determines how long the system keeps the output code of the page in the cache (if output caching is enabled).

By default, the system automatically clears the output cache of the page if you update the page’s content, properties or page template. You can manually remove the page from the output cache by clicking Clear output cache.

Allow file system cache

Indicates if the system stores the page’s output cache on the server’s file system. This provides persistent caching in case of application restarts.

If disabled, the application only caches the page output in its memory. If enabled, the system checks both types of cache.

You can inherit the setting from the parent page.

The file system cache is stored for the number of minutes specified in the Cache output in file system (minutes) setting in Settings -> System -> Performance.

Web part settings

Instances of web parts provide the following properties for configuring content caching and partial output caching:

System settings

Cache item name

Sets the name of the cache key used for the content of the web part. If not specified, this name is generated automatically based on the site, page path, Web part control ID and current user.

Cache keys can be shared between multiple web parts displaying the same content on different pages in order to avoid keeping redundant data in the memory.

See also: Caching the data of page components

Cache minutes

Sets the number of minutes for which the content of the web part remains cached before the latest version is reloaded from the database.

If empty, the web part uses the value entered into the Settings -> System -> Performance -> Server content caching -> Cache content (minutes) setting.

If set to 0, the web part does not use content caching.

Cache dependencies

Allows you to specify a list of cache keys on which the content cache of the web part depends. When the specified cache items change, the system deletes the content cache of the web part. Add one cache key per line.

If you check Use default cache dependencies, the web part uses dependencies that include all possible object changes that could affect the content of the given web part.

See also: Setting cache dependencies

Performance

Partial cache (minutes)

Sets the number of minutes for which system caches the output HTML code of the web part. Partial caching is similar to to full-page caching, but only for the code of the web part specifically.

If left empty or set to 0, partial caching is not used for the web part.

Important: Partial caching must also be allowed in the website’s settings. Administrators can enable partial caching in Settings -> System -> Performance.

See also: Caching portions of the page output

Partial cache dependencies

Allows you to specify a list of cache keys on which the partial cache of the web part depends. When the specified cache items change, the system clears the partial cache of the web part. Add one cache key per line.

If you check Use default cache dependencies, the web part uses dependencies that include all possible object changes that could affect the given web part.

Preserve partial cache on postback

By default, the system clears the partial cache of web parts whenever a postback occurs on the page. If you enable this property, the partial cache of the given web part instance persists through postbacks.