cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Grzegorz Kossakowski <>
Subject Re: Caching output from xpathdirectory generator
Date Tue, 10 Apr 2007 15:49:14 GMT
Fergus McMenemie napisaƂ(a):
> Hi all,
> Beginner question!
> I have a directory containing some 1000 xml documents,
> each of which describes a car. I use the xpathdirectory
> generator to extract some elements about each car. The
> directory is then displayed to the user in a series of
> columns with one row per car or file. I have column headers
> which allow the  output to be reordered as per the content
> of a particular column.
> I suspect that the directory is being reparsed for each 
> different sortby value. It takes ages. I would like to
> be able to cache the output from the directory parsing
> irrespective of different values of sortby. How do I do it?
> Also I intend to do a lot of this type of thing. How do I
> arrange for my caches to be saved to disk?
> <map:pipeline type="caching">
>    <map:match type="regexp" pattern="cars(.?sortby=(\w+))?">
>       <map:generate type="xpathdirectory" src="{fergus:release}/cars">
>          <map:parameter name="depth" value="2"/>
>          <map:parameter name="exclude" value=".DS_Store"/>
>          <map:parameter name="xpath" value="/car/colour|/car/model|/car/year"/>
>          </map:generate>
>       <map:transform type="xslt" src="xslt/carsummary1.xslt">
>          <map:parameter name="sortby" value="{2}"/>
>          <map:parameter name="sortprefix" value="sortby"/>
>          <map:parameter name="sortorder" value="sortorder"/>
>          </map:transform>
>       <map:serialize type="html"/>
>       </map:match>
>    </map:pipeline>
Even though, all components from your pipeline are cacheable you are 
right. Generator is called each time you change sort order.
It is that way because "caching" pipeline gives "all or nothing" 
caching. It means that, if some component in the pipeline must be 
executed again it is done so for all components from the pipeline.
It is odd situation, and I suggest to use "caching-point" which will 
reuse output from directory generator thus perform much better.

Grzegorz Kossakowski

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message