Configure L2 cache settings

L2 cache in Sitefinity CMS is used to cache database query results for subsequent requests. Using L2 cache can significantly increase the overall performance of your application. For example, when you open the list of news items in the backend for the first time, data is requested from the database to populate the list. Sitefinity CMS underlying ORM caches the data and subsequent request return the cached response. 

Enable / Disable L2 cache

The L2 cache in Sitefinity CMS can be enabled or disabled via changing the Enable data caching property available under Administration -> Settings -> Advanced -> Data. The supported values are:

  • True  - L2 cache is turned on
  • False - L2 cache is explicitly disabled 

NOTE: By default, the value of this property is left empty. This means that Sitefinity CMS will automatically determine the best setting, depending on the hosting scenario.

Configure L2 cache strategies

You can configure the L2 cache settings per persistent type - both in Network Load Balanced (NLB) environment as well as single instance environment.
By default, caching is enabled for all persistent types. By configuring the L2 Cache Strategies setting, you can specify which persistent types not to use the L2 cache.

RECOMMENDATION: It is recommended to have the L2 cache turned on for all persistent types and disable it only for testing purposes.

Configure the L2 cache strategy for a specific persistent type

  1. In Sitefinity CMS backend navigate Settings » Advanced » Data » Database Mapping Options » L2 Cache Strategies
  2. In the CLR Type field, enter the class name of the persistent type whose L2 cache strategy you are configuring.
    For example, Telerik.Sitefinity.News.Model.NewsItem
  3. In the Cache Strategy field, enter one of the following:
    • Yes or blank - L2 cache is enabled for this type
    • No - L2 cache is disabled for this type
  4. For your changes to take effect, restart your application.

When you change the L2 cache strategy for a specific content type, the strategy does not automatically apply to any related types. For example, if you disable the L2 cache for the Blog content type, you actually do not disable the L2 cache for the Blogpost content type. To disable L2 cache for the Blogpost type, you need to explicitly do so.

NOTE: Turning off L2 cache for the DynamicContent type turns it off for every artificial type created with the DynamicModule builder. Turning off L2 cache for taxonomies turns it off for all Ecommerce departments because departments classify as a taxonomy.

Want to learn more?

Sign up for our free beginner training. Boost your credentials through advanced courses and certification.
Register for Sitefinity training and certification.

Was this article helpful?