pipeline:cache

Purpose

The root element for a pipeline cache process. Once executed, the named cache is held until the application server is stopped or restarted, flushed manually, or until the expiry time set by the contained cache-control element is reached. The cache stores objects based on the key attribute. The key is then counted and used as a reference against the cache size. The cache uses the least-recently-used strategy for handling its content. Cache configuration parameters are contained in the mcs-config.xml file.

Contains

Attributes

Attribute Description Type Default Options Use
expiry-mode The caching operation supports two different strategies for determining whether an entry in the cache has expired: 'auto' and 'fixed-age'. In 'auto' mode the cache operation collates dependency information about the sources used to generate the content and uses that information to check the validity of the cached content and revalidate if necessary. The operation relies on the information supplied by the sources and therefore using sources that do not provide that information will prevent the cache from being effective. In 'fixed-age' mode the cache operation ignores any cache control information provided by the original sources and instead uses a time to live value supplied to the operation by the page author. In this mode the cache can require a lot of manual management as it will not automatically detect changes in the external sources from which the cached content was generated. Overrides the cache and caching-operation settings in the mcs-config.xml file. xs:string auto  fixed-age, auto  optional 
key Key used to access the cache. If the attribute is specified it is given to the caching process. If no key is defined, the element must contain a pipeline:cacheInfo element followed by operation markup elements. xs:string none    optional 
max-wait-time Determines how long a thread will wait for the entry to be updated. The purpose of this attribute is to ensure that threads do not wait forever for a cache entry to be updated, it is not a general timeout for limiting the time spent processing the cache body. Its value can be either a non negative integer specifying time in seconds, or the keyword 'forever'. xs:unsignedInt     optional 
name Name associated with the cache. The attribute is passed directly to the caching process. xs:string none    required 

Examples

<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/2002/06/xhtml2"
  xmlns:pipeline="http://www.volantis.com/xmlns/marlin-pipeline"
  xmlns:webd="http://www.volantis.com/xmlns/marlin-web-driver">
  <head>
    <title>Pipeline cache</title>
  </head>
  <body>
    <div>
      <pipeline:cache name="jiveCache">
        <pipeline:cacheInfo>
          <pipeline:cacheKey value="weatherConditions"/>
          <pipeline:cacheControl timeToLive="60"/>
        </pipeline:cacheInfo>
        <pipeline:cacheBody>
          <pipeline:transform href="test.xsl">
            <webd:get url="http://weather.yahooapis.com/forecastrss">
              <webd:parameters>
                <webd:parameter name="p" value="USWA0395"/>
                <webd:parameter name="u" value="c"/>
              </webd:parameters>
            </webd:get>
          </pipeline:transform>
        </pipeline:cacheBody>
      </pipeline:cache>
    </div>
  </body>
</html>

The pipeline-configuration section in mcs-config.xml must contain the 'jiveCache' cache configuration.

<caching-operation>
  <cache name="jiveCache"
    max-entries="10"
    strategy="least-recently-used"/>
</caching-operation>

The test.xsl transform should have the following form.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
  xmlns:yweather="http://xml.weather.yahoo.com/ns/rss/1.0"
  xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#">
  <xsl:output method="xml"/>
  <xsl:template match="/">
    <div xmlns="http://www.w3.org/2002/06/xhtml2">
      <h3>
        <xsl:value-of select="/rss/channel/item/title"/>
      </h3>
      <p>Current Conditions: <xsl:value-of select="/rss/channel/item/yweather:condition/@text"/>,
        <xsl:value-of select="/rss/channel/item/yweather:condition/@temp"/>
        <xsl:value-of select="/rss/channel/yweather:units/@temperature"/>.</p>
    </div>
  </xsl:template>
</xsl:stylesheet>

Related topics