Enable sliding cache expiration in Commerce Engine Connect

Abstract

How to enable sliding cache expiration in Commerce Engine Connect caching.

You can enable sliding cache expiration on the Commerce Engine Connect cache. The sliding cache allows frequently requested entities to be stored for longer, which means quicker access to data when responding to Storefront requests. When using the sliding cache, the cache duration increases by the specified value every time the data is requested. The more often an entity is requested, the longer it remains in the cache. Rarely requested entities do not remain in cache.

By default, the sliding expiration is disabled.

To enable sliding expiration on the Commerce Engine Connect cache:

  1. Open the \wwwroot\<Sitecore>\App_Config\Include\Y.Commerce.Engine\Sitecore.Commerce.Engine.Connect.config file.

  2. In the cacheEntry configuration section, add the slidingExpiration property with the required value (in milliseconds). For example:

     <cacheEntry type="Sitecore.Commerce.Engine.Connect.CacheEntrySettings, Sitecore.Commerce.Engine.Connect.Caching">
         <cacheName>CommerceConnect</cacheName>
         <slidingExpiration>36000000<slidingExpiration>
         <Expiration>21600000</expiration>
     </cacheEntry>