Core Caching
Core Caching
Available Caches
The ep-core-caching module provides three out-of-the-box application caches to improve performance. These caches are available to both storefront and cortex. To monitor these caches, see Monitoring EhCache.
The table below lists the three caches and their default timeout values in seconds:
Cache Name | Description | Settings prefix | timeToLive | timeToIdle | maxEntriesInHeap |
---|---|---|---|---|---|
categoryLookupCache | Caches categories. | COMMERCE/SYSTEM/CACHING/CATEGORY | 1 | 1 | 1000 |
productLookupCache | Caches products. | COMMERCE/SYSTEM/CACHING/PRODUCT | 1 | 1 | 5000 |
productSkuLookupCache | Caches product skus. | COMMERCE/SYSTEM/CACHING/PRODUCTSKU | 1 | 1 | 10000 |
Configuring the Cache
Core caches are configured via the settings framework. There are three settings for each cache: timeToIdle, timeToLive, and maxEntriesLocalHeap.
For example, to change the timeToIdle and timeToLive values for the category cache to 5 minutes, change the values of the COMMERCE/SYSTEM/CACHING/CATEGORY/timeToLive and COMMERCE/SYSTEM/CACHING/CATEGORY/timeToIdle settings to 300. Note that the changes will not take effect until the application is restarted. For details on how to change these system settings, see Configuring System Settings.
Disabling Caching
Core caches have a corresponding "lookup" bean declaration in ep-core/src/main/resources/spring/service.xml. By overriding these beans in the following way, you can disable a core cache. For example, to disable the category cache, replace the categoryLookup bean definition:
<bean id="categoryLookup" class="com.elasticpath.commons.beanframework.SwitchableProxyFactoryBean"> <property name="proxyInterface" value="com.elasticpath.service.catalog.CategoryLookup"/commerce-legacy/> <property name="proxy" ref="categoryLookupProxy"/commerce-legacy/> </bean>
with:
<alias name="nonCachingCategoryLookup" alias="categoryLookup"/commerce-legacy/>