HCL Commerce Search caching
HCL Commerce Search uses fragment caching in the storefront.
- Search results from the search results page are not cached unless a category ID is associated with them. That is, search results with facets or search terms are not cached.
For a fragment to be cacheable, it must be self-executable. Each dynamically included JSP file
must contain its own <cache-entry>
defined in the
cachespec.xml
file. This <cache-entry>
is required to have the
JSP file served up by the dynamic cache when it receives a request. Otherwise, each dynamically
included JSP file is re-executed for each request. For example, if StoreCatalogDisplay.jsp
dynamically includes CachedHeaderDisplay.jsp, CachedFooterDisplay.jsp and
CachedStoreCatalogDisplay.jsp and you only set up a <cache-entry> for the
CachedStoreCatalogDisplay.jsp. Then, when you request the StoreCatalogDisplay page, the
CachedStoreCatalogDisplay.jsp, CachedHeaderDisplay.jsp, and CachedFooterDisplay.jsp files are
executed if they are not cached.
Catalog filter caching
If your site uses catalog filters, ensure that catalog filter caching is enabled.
Cache invalidation
When the search index is updated, the search related cache entries must be invalidated using the Dynacache API.
- com.ibm.websphere.cache.invalidateById
- com.ibm.websphere.cache.invalidateByTemplate
- com.ibm.websphere.cache.clear
HCL Commerce also provides a DynaCacheInvalidation command, which is called by the scheduler periodically to process the records in the CACHEIVL table. It then calls the WebSphere Application Server dynamic cache invalidation APIs to invalidate the specified cache entries. By default, the schedule interval is every 10 minutes. For more information about this invalidation process, seeCache invalidation.
Caching considerations for HCL Commerce Search
You can use fragment caching for HCL Commerce Search results. However, you must practice caution to ensure that your caching strategy performs well. At a minimum, you must test your caching strategies before publishing your store to production.
In addition to using DynaCache in the HCL Commerce server and caching some of the relatively static search data, such as auto-suggested search entries, you can use the WebSphere Commerce search server to cache index data in memory. The size of the index cache pools must be configured based on the memory heap size that is allocated for the search server.