Setting up the cachespec.xml to full-page cache TopCategoriesDisplay
In this lesson, you will learn how to set up the cachespec.xml file to full-page cache TopCategoriesDisplay.
Procedure
- Open the cachespec.xml file located in WC_eardir \Stores.war\WEB-INF.
-
Add a
cache-entry
for the
TopCategoriesDisplay
page
to the cachespec.xml file. In order to do this, add the following
code into the file:
<cache-entry> <class> servlet</class> <name> com.ibm.commerce.struts.ECActionServlet.class</name> <property name="consume-subfragments"> true</property> <property name="save-attributes"> false</property> <property name="store-cookies"> false</property> <!-- StoreCatalogDisplay?storeId=<storeId> --> <!-- TopCategoriesDisplay?storeId=<storeId> &catalogId=<catalogId> --> <cache-id> <component id="" type="pathinfo"> <required> true</required> <value> /TopCategoriesDisplay</value> </component> <component id="storeId" type="parameter"> <required> true</required> </component> <component id="catalogId" type="parameter"> <required> true</required> </component> </cache-id> </cache-entry>
Note: A sample cachespec.xml file containing the required cache-entry for different entities is available in this: Sample cachespec.xml file . -
Test out your cachespec.xml file. You do not need
to restart the server for the new cachespec.xml file to take effect.
- Open the cache monitor, go to Cache Policies , and verify that the new policy is listed. It will appear as /webapp/wcs/stores/com.ibm.commerce.struts.ECActionServlet.class
- Select the TopCategoriesDisplay page.
- Verify that there is a cache-entry present for the TopCategoriesDisplay page.