IBM Support

Behavior of do-not-consume in Dynamic Cache

Troubleshooting


Problem

Behavior of the do-not-consume property when specified in the cachespec.xml

Resolving The Problem

Do-not-consume in Dynamic Cache

Property
Valid classes
Value
do-not-consumeServlet or Web serviceTrue or false. Default is false. When a fragment parent has the consume-subfragment property set to true the child fragment content is saved in the cache entry of the parent. Do-not-consume (DNC) tells the cache to stop saving the content for this fragment in the parent cache-entry and create a placeholder instead for the include or forward.

A <cache-entry> element without a <cache-id> is not a valid case because Dynamic Cache would be unable to generate a cache-id to determine if the fragment is cacheable. You can add a simple cache-id that only contains a timeout or priority. The following cache-id will be matched for all requests:

For example:

<cache-id>                                                            
      <priority>2</priority>                                            
 </cache-id>    

When using do-not-consume the fragment is not consumed by the parent but it is still cached as a separate entry in cache. This means that on subsequent requests you will still get a cache-hit for the child fragment when the parent performs the include.

do-not-consume function designed to reduce the whole page invalidations that occur because of dependencies on the children fragments.

In case of child fragment not be consumed by the parent and also not cached at all you would need to have a cache policy that specifies a very small timeout for the fragment marked do-not-consume so that the cached entry will timeout before the next request.

For example:

   <cache-entry>
    <class>servlet</class>
      <name>/output.jsp</name>
      <property name="do-not-consume">true</property>
     <cache-id>                                                                                                          
        <timeout>1</timeout>                                                                                          
    </cache-id>                                            

   </cache-entry>

Another option outside of configuring cachespec.xml would be to use the
com.ibm.websphere.servlet.cache.ServletCacheResponse.setDoNotConsume()

API:
/**
* This sets the page to not be consumed by its parents
* @param value True if the page is to be set as do-not-consume
* @ibm-api
*/
public void setDoNotConsume(boolean doNotConsume);

If no cache policy is created for the child fragment and you call setDoNotConsume(true) then the child fragment will not be consumed by its parents and also will not be cached.

[{"Product":{"code":"SSEQTP","label":"WebSphere Application Server"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Dynamic Cache","Platform":[{"code":"PF002","label":"AIX"}],"Version":"8.5.5;8.5;8.0;7.0;6.1;6.0","Edition":"Edition Independent","Line of Business":{"code":"LOB45","label":"Automation"}},{"Product":{"code":"SSNVBF","label":"Runtimes for Java Technology"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"Java SDK","Platform":[{"code":"","label":""}],"Version":"","Edition":"","Line of Business":{"code":"LOB36","label":"IBM Automation"}}]

Document Information

Modified date:
15 June 2018

UID

swg21213260