Cache-entry elements

The root element of the cachespec.xml file, <cache>, contains <cache-entry> elements. The WebSphere dynamic cache service parses the cachespec.xml file during startup, and extracts a set of configuration parameters from each <cache-entry> element.

The following sections explain other <cache-entry> elements such as <timeout>, and <priority> that configure information such as cache expiry and cache eviction policy.

Class

<class>servlet | command</class>

The <class> element is required. It governs how the application server interprets the remaining cache policy definition. The value servlet indicates that the cache policy defines caching rules for a servlet or a JavaServer Page (JSP) deployed in the WebSphere Application Server servlet engine. The value command indicates that the cache policy defines caching rules for a class that implements the WebSphere CacheableCommand Java interface.

The following are examples of the <class> element:


<class>command</class>
<class>servlet</class>
Note: While WebSphere Commerce Version 6.0 commands implement the CacheableCommand Java interface, almost all of them also extend from the AbstractECTargetableCommand Java class. Because that class does not implement the Serializable interface that runs on Java, these commands cannot be cached. They can, however, be used to generate cache invalidation IDs, as specified by the <invalidation> element. Refer to the Cache invalidation methodologies section for details.

Name


<name>classname</name>

The <name> element is required. classname specifies the fully qualified class name of the command or servlet. There are two ways to use the <name> element to specify a cacheable object:

  • For commands, classname must specify the fully qualified classname, including the package name, if any, and class name, as well as the trailing .class qualifier, of the configured object.
  • For servlets or JSPs , this element must include the fully qualified class name of the servlet, or the full URI of the JSP.

You can specify multiple <name> elements within a <cache-entry> if you have different mappings that refer to the same Servlet. The following are examples of the <name> element:

<name>com.ibm.commerce.dynacache.commands.MemberGroupsCacheCmdImpl.class</name>
<name>com.ibm.commerce.struts.ECActionServlet.class</name>
<name>/ToolTech/ShoppingArea/CatalogSection/CategorySubsection/StoreCatalogDisplay.jsp</name>

Property

<property name="key">value</property>

where key is the name of the property being defined, and value is the corresponding value.

The following table contains properties used by WebSphere Commerce when defining cache rules for servlets.

Notes:

  1. For a complete list of properties, see the topic cachespec.xml.
  2. The do-not-cache property can be used. Check the details for fix PK39161.
Property Valid Values Default Value Description
EdgeCacheable

true
false

false If this property is true, the given servlet or JSP file is externally available from an edge server. Whether the servlet or JSP file is cacheable, depends on the rest of the cache specification.
consume-subfragments

true
false

false When a servlet is cached, only the content of that servlet is stored, with placeholders for any other fragments it includes or to which it forwards. Consume-subfragments (CSF) tells the cache not to stop saving content when it includes a child servlet. The parent entry (the one marked CSF) will include all the content from all fragments in its cache entry, resulting in one large cache entry that has no includes or forwards, but rather the content from the whole tree of entries. This can save a significant amount of application server processing, but is typically only useful when the external HTTP request contains all the information needed to determine the entire tree of included fragments.
save-attributes

true
false

true When this property is set to false, the request attributes are not saved with the cache entry.
store-cookies

true
false

true When this property is set to false, the request cookies are not saved with the cache entry.
alternate_url Specifies the alternate URL used to invoke the servlet or JSP file. This property is ignored unless the EdgeCacheable property is also set for the cache entry.
do-not-consume

true
false

false When this property is set to true, the fragment will not be consumed by the parent entry with the consume-subfragments property.
persist-to-disk

true
false

true When this property is set to false, the cache entry is not written to the disk when an overflow or server stop occurs. The default value of true is recommended for long lived data that can be reused by many shoppers. However, for both performance and privacy concerns, it is generally not recommended to persist user-related data to disk.

The following are examples of the <property> element:


<property name="consume-subfragments">true</property>
<property name="save-attributes">false</property>
<property name="store-cookies">false</property>
Note: By default, the dynamic cache service caches all cookies and request attributes (when caching results from a servlet or JSP execution) along with the cached results. However, WebSphere Commerce cookies and request attributes contain user specific information which should not be cached. Therefore, the following <property> elements must be specified for a servlet <cache-entry> element:
<property name="save-attributes">false</property>
<property name="store-cookies">false</property>
And the following <property> element must be specified for a JSP <cache-entry> element:
<property name="save-attributes">false</property>