Home


do-not-consume

The purpose of this property is often misunderstood by the DynaCache novice. When set to "true," the do-not-consume property instructs DynaCache to cache the item independently of any consuming parent that it belongs to. It does not mean "do-not-cache." A simple analogy to explain it is "do not make me live with my all-consuming parent in the cache, I want to be independent, thank you."

The do-not-consume property works particularly well for situations where only a small portion of a candidate Web page contains personalized information, for example, a personalized welcome message or a mini shopping cart. In this scenario, you would want to cache the majority of the page, but separate the personalized bit. By using the do-not-consume property, most of a page can be rendered from the cache and completed with a portion that has been cached elsewhere, or not cached at all.

So, for the latter scenario to work properly, the parent object's <cache-entry> would be marked with the property consume-subfragments and the child fragment that contains the personalization area would be marked with the do-not-consume property.

With this combination, you can achieve performance gains that approach those of whole page caching and still provide personalized content.

Example | -14 includes sample cachespec entries that show how to use the two properties "do-not-consume" and "consume-subfragments." Notice that the "do-not-consume" child component (that is, the mini shopping cart) must be declared before the parent object, which in the example is StoreCatalogDisplay.

Example 2-14 do-not-consume and consume-subfragments properties in action

<cache-entry>
    <class>servlet</class> 
    <name>/MiniCurrentOrderDisplay.jsp</name>
    <property name="do-not-consume">true</property> 
    <property name="save-attributes">false</property> 
    <cache-id> 
        <component id="DC_userId" type="attribute"> 
            <required>true</required> 
        </component> 
    </cache-id> 
</cache-entry> 

<cache-entry> 
    <class>servlet</class> 
    <name>com.ibm.commerce.server.EACActionServlet.class</name> 
    <property name="store-cookies">false</property> 
    <property name="save-attributes">false</property> 
    <property name="consume-subfragments">true</property> 
    <cache-id> 
        <component id="" type="pathinfo"> 
            <required>true</required> 
            <value>/StoreCatalogDisplay</value> 
        </component>
        <component id="storeId" type="parameter">
            <required>true</required>
        </component>
        <component id="catalogId" type="parameter">
            <required>true</required>
        </component>
    </cache-id>
</cache-entry> 

+

Search Tips   |   Advanced Search