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 start-up, 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.
- For a complete list of properties, see the topic cachespec.xml.
- The do-not-cache property can be used. Check the details for .
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 Serverservlet 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>
<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>com.ibm.commerce.struts.v2.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 HCL Commerce when defining cache rules for servlets.
Property | Valid Values | Default Value | Description |
---|---|---|---|
EdgeCacheable | true |
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 | 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 |
true | When this property is set to false, the request attributes are not saved with the cache entry. |
store-cookies | true |
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 | 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 |
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>
<property>
elements must be specified
for a servlet <cache-entry>
element:<property name="save-attributes">false</property>
<property name="store-cookies">false</property>
<property>
element must be specified for a JSP
<cache-entry>
element:<property name="save-attributes">false</property>