Announcement: You can find the guides for Commerce 7.5 and later on the new Elastic Path Documentation site. This Developer Center contains the guides for Commerce 6.13.0 through 7.4.1.Visit new site

This version of Elastic Path Commerce is no longer supported or maintained. To upgrade to the latest version, contact your Elastic Path representative.

Storefront Caching

Storefront Caching

Available Caches

The storefront uses four out-of-the-box application caches to improve performance. To monitor these caches, see Monitoring EhCache.

The table below lists the four caches and their default timeout values in seconds:

Cache Name Description timeToLive timeToIdle
productAssociationCache Caches product associations. 600 600
ruleEngineDataCache Caches the rules used by promotions. 10 10
sellingContextDataCache Caches selling context. 600 600
storeCache Caches the whole store. 10 10
  • timeToIdle - the maximum number of seconds between accesses before cached data expires.
  • timeToLive - the maximum number of seconds between creation time and when data expires.

Configuring Storefront Cache

All caches are children of an abstractCacheBean that is defined in ep-core\src\main\resources\spring\service\service.xml. The abstractCacheBean gives caches a default timeToIdle and timeToLive value of 600 seconds and can be modified to give different default values to all caches.

Storefront caches are beans defined in ep-storefront\src\main\resources\spring\cache\cache.xml. For each cache, you can set a different timeToLive and timeToIdle by modifying these beans and rebuilding the Storefront.

For example, to change the timeToIdle and timeToLive values for the store cache to 5 minutes, modify the properties of the productCache bean as shown:

<bean id="storeCache" parent="abstractCacheBean">
	<property name="timeToLive" value="300"/commerce-legacy/>
	<property name="timeToIdle" value="300"/commerce-legacy/>
</bean>
Note:

Modifying the abstractCacheBean will affect other caches, such as the ProductCharacteristicsCache.

Invalidating the Cache

When you make changes to the storefront's properties or velocity templates, you sometimes need to clear the storefront's cache for the change to take effect. To invalidate the cache, open your store in a web browser and append /invalidate-cache.ep to your storefront URL.

For example, if your storefront URL is demo.elasticpath.com:8080/storefront, you can invalidate your cache by opening demo.elasticpath.com:8080/storefront /invalidate-cache.ep in a web browser.