Kentico Xperience 13 documentation and ASP.NET Core

Most documentation about running Xperience applications under ASP.NET Core can be found in a dedicated section: Developing Xperience applications using ASP.NET Core. The rest of the documentation still applies, but some code samples and scenarios might need slight modifications for Core projects.

All major differences between the MVC 5 and Core platforms are summarized in Migrating to ASP.NET Core.


Setting cache dependencies

Cache dependencies allow the application to automatically clear cached data when related objects are modified.

The system uses dummy cache keys to create dependencies between cached data and other objects. Dummy keys are cache items without any data that represent objects or groups of objects. When an object is modified, the system "touches" the corresponding dummy keys, which causes the cache to delete all items that depend on the given dummy keys.

Related pages

Sample scenario

A page with the /Products alias path displays a list of products (pages), which are placed as child items in the content tree. The product data is cached in the page's MVC code and has a dependency on the node|samplesite|/products|childnodes dummy key, which the system creates automatically.

When a visitor requests the Products page, the product data for the list is loaded from the database and stored in the content cache. If a child page of the Products page is modified, the dummy key is touched, and the cache deletes the dependent data.

The following table shows which dummy cache keys are touched when objects are modified:

Object typeTouched dummy keysSample dummy key values

(content tree nodes)

node|<site name>|<alias path>|<culture>
node|<site name>|<alias path>
nodeid|<node id>
nodeid|<linked node id>
documentid|<document id>
documentid|<document id>|attachments
documentguid|<site name>|<document guid>
nodes|<site name>|<page type code name>|all
nodeguid|<site name>|<node guid>

+ for all ancestors of the modified page:
node|<site name>|<alias path>|childnodes

documentguid|samplesite|a58ed488-5545-48d0- ...
nodeguid|samplesite|a58ed488-5545-48d0- ...


(not pages)

<object type>|all
<object type>|byid|<id>
<object type>|byname|<code name>
<object type>|byguid|<guid>

Tip: You can find the object type values in the System application on the Object types tab.

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



metafile|1ced44f3-f2fc- ...
Page attachments

documentid|<attachment document id>
documentid|<attachment document id>|attachments

attachment|1ced44f3-f2fc- ...

Page relationships

nodeid|<node id>|relationshipsnodeid|5|relationships
Avatarsavatarfile|<guid>avatarfile|1ced44f3-f2fc- ...
Media filesmediafile|<guid>
mediafile|1ced44f3-f2fc- ...
mediafile|preview|1ced44f3-f2fc- ...
Custom table data records

customtableitem.<custom table code name>|all
customtableitem.<custom table code name>|byid|<id>


Dependencies on form data records

The system currently does not touch any dummy cache keys when changes occur for data submitted via forms.

As a workaround, developers can prepare custom event handlers for BizFormItemEvents. Use the handler method to touch a custom cache key, and then enter the key into your cache dependencies. For example:

private void FormItem_InsertAfterHandler(object sender, BizFormItemEventArgs e)
	// Touches a custom cache key, for example: "customformdata|bizform.contactus"
	CacheHelper.TouchKey("customformdata|" + e.Item.BizFormClassName);

Adding custom cache dependencies

You can set custom cache dependencies when caching retrieved data or page output using the API. See Caching on MVC sites.

Create the dependencies by preparing a string with the names of dummy cache keys, and then call the CacheHelper.GetCacheDependency method on the string. The system automatically clears the related cache when the specified dummy keys are touched (i.e. when the corresponding objects are modified).


Scenario: You have an MVC page displaying a list of articles, and the code used to retrieve the article data uses the API for caching. You need to clear the cached article data whenever one of the article pages is modified.

Solution: When preparing the CacheSettings parameter in the code, add the nodes|<site name>|<article page type code name>|all dummy key as a cache dependency. The system touches this dummy key whenever any article page of the given type is updated.

Was this page helpful?