Debugging cache

If you encounter unexpected caching behavior or any problems related to the cache, you can use the system’s debugging functionality to:

  • Check the exact content of the application’s cache
  • Monitor caching operations for web requests

You can access the system’s debugging interface through the Debug application.

Viewing the stored cache items

On the Cache items tab, you can see which Data items and Dummy keys (cache dependencies) are currently stored in the system’s server-side cache.

Viewing cache items

You can delete individual cache keys by clicking Delete () next to the corresponding items. To remove all items from the cache, click Clear cache.

Clicking View () next to a cache key opens a new window showing 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 – Kentico uses two priorities for cache items: High and NotRemovable (will not be deleted from the cache as the server frees system memory).
  • Dependencies – list of dummy keys on which the cache item depends. The system removes the cache item if any of the dummy keys are touched (modified).
  • Object type – the type of the cached item.
  • Fields – the fields storing the actual data of the cached item (depend on the item’s object type).

Viewing the details of a cache item

If you need even more information about a cached object, click Debug () next to the item in the list of cache keys. Debugging cache keys allows you to browse the full system data of the given object, including all properties, variables and related objects.

Note: The list of cache items does not display the partial output cache stored for page components.

Debugging cache access

The cache access debug allows you to view the cache operations that the system performs for individual web requests (adding items to the cache, loading data from the cache).

Enabling the cache access debug

To use cache access debugging, you need to adjust the settings in Settings -> System -> Debug:

Setting

Description

Enable cache access debug

Enables cache access debugging and the Cache access tab in the Debug application.

Display cache access debug on live site

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

Debug cache access of UI pages

If enabled, the cache access debug also covers requests for pages of the administration interface. Requires cache access debugging to be enabled.

Cache access debug log length

Sets the maximum length of the cache access debug log on the Cache access tab of the debugging interface, i.e. the number of requests for which debug information is preserved and displayed.

If empty, the value of the Default log length setting is used.

Display stack information

If enabled, the system tracks the code stack when debugging cache access and displays the information 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.

Log cache access to file

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

Tip: You can also enable cache access debugging through the “debug everything” settings in the All section of the Debug settings category.

Monitoring cache access

To view which cache operations the system performed for recent web requests:

  1. Open the Debug application.
  2. Select the Cache access tab.

You can see the URLs of web requests and the time when the system processed the requests. The table below each request contains the cache items that the system accessed during the request. The table provides the following information for each cache item:

  • The type of Access (Get, Add)

  • The name of the accessed Cache key

  • The cache item’s dependencies

  • The object type and size of the cached Data

  • The Context in which the cache item was accessed (API method)

    • Click on the method to see the stack trace of the cache access
    • If you enable the Show complete context option at the top of the interface, the stack trace is displayed for all cache items.

Click Clear debug log to remove all records in the cache access debug. To remove the actual data from the system’s cache, click Clear cache.

Debugging the system’s cache access operations

Clicking View () next to a cache key opens a new window showing 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 – Kentico uses two priorities for cache items: High and NotRemovable (will not be deleted from the cache as the server frees system memory).
  • Dependencies – list of dummy keys on which the cache item depends. The system removes the cache item if any of the dummy keys are touched (modified).
  • Object type – the type of the cached item.
  • Fields – the fields storing the actual cached data (different for each object type).