Tutorial: Improve WebSphere Commerce performance with dynamic caching >
< Previous

 

Set up the cachespec.xml to full-page cache TopCategoriesDisplay


This section is related to setting up the cachespec.xml to full-page cache TopCategoriesDisplay.

  1. Open the cachespec.xml file located at WC_eardir\Stores.war\WEB-INF.

  2. Add a cache-entry for the TopCategoriesDisplay page to the cachespec.xml.

    1. Cache the servlet, com.ibm.commerce.struts.ECActionServlet.class.

    2. Include a pathinfo component with the value /TopCategoriesDisplay and a parameter type component for the storeId and for the catalogId.

    3. Set the required value of all components to true.

    4. Ensure that the consume-sub-fragments flag exists and is set to true for the cache-entry.

    • A sample cachespec.xml file containing the required cache-entry is available in this zip format.

    Your completed cache-entry for TopCategoriesDisplay should look like this

    <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>
    
    
    

  3. Test out your cachespec.xml.

    You do not need to restart the server for the new cachespec.xml to take effect.

    1. Open the cache monitor, and verify that the new policy is listed.

    2. Hit the TopCategoriesDisplay page.

    3. Verify that there is a cache-entry present for the TopCategoriesDisplay page.


< Previous