Home | 2.6.3 Cache ID Overview | 2.6.5 Cache programming support


2.6.4 Cache IDs and the cache hit

Once a cache ID is safely stored in the cache, any subsequent requests that match with the cache ID are served from the cache (a cache "hit"). The <cache-id> rules define how to construct cache IDs from information associated with a client HTTP request.

Here is an an example of a cache entry that will cache the output from the StoreCatalogDisplay JSP. The example shows two parameter values (storeid and catalogId) that together with the name of the JSP will form the unique cache ID that is used to store and retrieve the object from cache. Requests made to the StoreCatalogDisplay JSP containing previously unseen storeid or catalogId parameter values will result in the creation of a new cache entry.

Example 2-3 Cache entry defining a cache id

<cache-entry> 
  <class>servlet</class> 
  <name>/StoreCatalogDisplay.jsp</name> 
  <property name="save-attributes">false</property> 
  <property name="store-cookies">false</property> 
  <timeout>3600</timeout> 
  <priority>3</priority> 
  <cache-id> 
    <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