Enable sliding cache expiration in Commerce Engine Connect
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, patch the configuration as follows:
-
Open the
\wwwroot\<Sitecore>\App_Config\Include\Y.Commerce.Engine\CustomCommerce\Custom .Commerce.Engine.Connect.config
patch file. -
In the
<!-- Cache Settings -->
section, add the following configuration patch with the requiredslidingExpiration
property value (in milliseconds). For example:RequestResponse<commerceCachingConfiguration type="Sitecore.Commerce.Engine.Connect.CommerceCachingConfiguration,Sitecore.Commerce.Engine.Connect.Caching"> <!-- Cache Settings --> <cachingSettings type="Sitecore.Commerce.Engine.Connect.CachingSettings, Sitecore.Commerce.Engine.Connect.Caching"> <cacheEntry type="Sitecore.Commerce.Engine.Connect.CacheEntrySettings, Sitecore.Commerce.Engine.Connect.Caching"> <slidingExpiration patch:instead="slidingExpiration">36000000<slidingExpiration> </cacheEntry>