Skip to main content
A Open Source Solution
Home Download Support Configuration Development ImagoX

The Imago caching engine is a fairly simple construct. After each step in the pipeline the result is cached provided that the result is not identified as being dynamic or has not already changed. The cache uses the concept of a Watchable item. Each Watchable item has the responsibility of determining when it has expired. Each Watchable item may comprise several Watchable items. Once a watchable item has expired the cached resource is removed from the cache. The net result is that when a request is made of Imago the cache is searched if the object is in the cache and has not expired it is returned. If the object is not found then the pipeline is constructed. At each step in the pipeline the cache is checked to see if the result of the step is a valid cache entry. If so it is returned and the processing is started from there. The example below should make this clear.

Requested Item Requested Processes Cacheable State
A.xml Base XML document Cachable
T1.xsl Simple transform Cachable
T2.xsl Simple transform Cachable
T3.xsl Dynamic transform Not Cachable
OutputFormatter HTML output formatter Not Cachable
  1. A request for A.xml is made by a client that requires HTML output, the cache checks to see if the result of the OutputFormatter is in the cache. It is not so the entire pipeline is constructed and the execution is begun. Imago uses a pull pipeline so the OutputFormatter step pulls the result from the T3.xsl step.
  2. The cache is checked for the result of the T3 pipeline step (A.xml:T2.xsl:T2.xsl:T3.xsl) which will not be found since T3 is a dynamic process. So T3.xsl pulls the result from the T2 step.
  3. The cache is checked for the result of the T2 pipeline step (A.xml:T2.xsl:T2.xsl) which will be found as T2 and all steps above it are not dynamic. The T2 cache element is deserialized as SAX events and fed to T3 step.
  4. Upon completion of the document the T3 step once again determines that it is dynamic and the entry is not cached. The result is passed to the OutputFormatter.
  5. The OutputFormatter does its task and determines that the preceding pipe step was dynamic so it is dynamic as well.
  6. The result is returned to the client.

If T2.xsl had been changed since it the (A.xml:T2.xsl:T2.xsl) entry was cached, it would be labeled as expired and regenerated. Thus the T1 level would be called.

It is important to understand the impact of dynamic data on the process. Transformations should be constructed such that dynamic data is added as late as possible.

In a more complex example a single XSL file could include multiple XSL and XML files as noted below. In this scenario step T2.xsl is cachable only if all the files it comprises are cachable. It should also be noted that T2.xsl, T2a.xsl, T2b.xsl, B.xml and C.xml will also exist in the cache if they are not dynamic. The documents that comprise T2.xsl may be included using any available XML document include process.

Requested Item Comprises Requested Process Cachable State
A.xml A.xml Base XML document Cachable
T1.xsl T1.xsl Simple transform Cachable
T2.xsl T2.xsl, T2a.xsl, T2b.xsl, B.xml, C.xml Complex transform Cachable if all elements are cachable
T3.xsl T3.xsl Dynamic transform Not Cachable
OutputFormatter OutputFormatter HTML output formatter Not Cachable
All trademarks and copyrights are the property of their respective owners.
Copyright © 2002-2004 by Xenei.com, All Rights Reserved
OpenSource.org
AnyBrowser.org
Xenei.org - Open Source Solutions