pipeline:cacheControl

Purpose

Controls the expiry of a named cache.

Contained by

Attribute

Attribute Description Type Default Options Use
timeToLive The length of time in seconds that the entry is valid from the time it enters the cache. Subsequent requests during this period to result in the entry being retrieved from the cache. If the period has expired, subsequent requests will result in the operation being re-executed. A value of zero is treated as an error. The string literal "forever" may be used to specify that the entry never expires. xs:unsignedInt forever    optional 

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