Kentico CMS 6.0 Developer's Guide

Cache access

Cache access

Previous topic Next topic Mail us feedback on this topic!  

Cache access

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

Cache access debugging can be turned on and configured either by adjusting certain settings in Site Manager -> Settings -> System -> Debug, or by adding certain keys into the AppSettings section of your web.config file. The following table lists and explains these settings and keys:

 

Setting

Web.config key

Description

Enable cache access debug

CMSDebugCache

Enables cache access debugging and the Cache access tab in Site Manager -> Administration -> System -> Debug.

Display cache access debug on live site

CMSDebugCacheLive

If enabled, cache access debug information is also displayed at the bottom of each live site page. This option requires cache access debugging to be enabled.

Debug cache access of UI pages

CMSDebugAllCaches

If enabled, access to data cached for pages of the administration interface (CMS Desk and Site Manager) will also be included in the cache access debug. This option requires cache access debugging to be enabled.

Log cache access to file

CMSLogCache

If enabled, cache access debug log is saved into the logcache.log file in the ~\App_Data folder. This option does not require cache access debugging to be enabled.

Cache access debug log length

CMSDebugCacheLogLength

Sets the maximum length of the cache access debug log on the Debug -> Cache access tab, i.e. the number of requests for which debug information is preserved and displayed on the tab. If empty, value of the Default log length setting (or the CMSDebugEverythingLogLength key) is used.

Display stack information

CMSDebugCacheStack

If enabled, stack is tracked when debugging cache access and is displayed in the Context column. This information is only available in the debugging UI and on the live site, not in the debug log written into the logcache.log file.

 

devguide_clip1740

 

It may happen that you specify different configuration in the settings and in the web.config file. In such cases, boolean settings (true/false) need to be enabled at least in one place (in web.config or in settings) in order to be enabled, while log lengths specified in Site Manager -> Settings have higher priority than log lengths specified in the web.config.

 

Here is a list of the keys for easy copy&paste into your web.config:

 

<add key="CMSDebugCache" value="true" />
<add key="CMSDebugCacheLive" value="true" />
<add key="CMSDebugAllCaches" value="true" />

<add key="CMSLogCache" value="true" />
<add key="CMSDebugCacheLogLength" value="10" />

<add key="CMSDebugCacheStack" value="true" />

 

Cache access debugging can also be enabled using the general settings and keys.

 

User interface

 

On the Debug -> Cache access tab, you can see a log of requests that accessed the system cache.

 

For each request, you can see the URL and time when it was processed. The table below the URL always shows the type of Access, the accessed Cache key, its cache dependencies, the object type and size of cached Data and the Context from which the cache was accessed. If you enable the Show complete context option, complete context of the cache access, i.e. not only the method that accessed the cache item, but also the methods from which the first one was called, will be shown in the Context column.

 

Enabling the Show complete context check-box displays complete context (not only the topmost item) in the Context column. All dummy keys can be cleared from the cache using the Clear cache button. Clicking the Clear cache log button clears all records in the log.

 

devguide_clip1223

 

If you click the View object (View) icon in a particular row, a pop-up window gets opened as in the screenshot below. There, you can see detailed information about the cached object:

 

Key - the key under which the object is stored in the cache.

Expiration - date and time when the cache item will expire (i.e. will be removed from the cache).

Priority - priority of the cache item. The same as ASP.NET cache item priorities, while only High and NotRemovable are used in Kentico CMS.

Dependencies - dummy keys on which the cache item is enabled.

Object type - type of the cached object.

 

Finally, the table under the Object type value represents the actual data of the cached object. Displayed fields vary based on the currently displayed object type. The cache item can be cleared from cache using the Delete Delete button in the top part of the window.

 

devguide_clip1528

 

For more information about caching in Kentico CMS, please refer to Development -> Caching and performance -> Caching options.