Changes since version 2.0.x

In the 2.0.x version of Apache Cocoon, the user would include the following in their cacheable XSP file prior to the output page content (I have removed the comments from the original sample for brevity's sake):

{{{ <xsp:structure>

In version 2.0.x of Apache Cocoon, the samples demonstrate how to implement cacheable XSP files using a combination of HashUtil and the CacheValidity interface.

New caching API for use in XSP (as well as other components)

In 2.1 and above, page authors are no longer required to generate their own hash key as a long value, and CacheValidity has been replaced with the SourceValidity interface.

The previous example would be written as follows in version 2.1 and above:




As you can see, this needs several new xsp:includes for the changed API.

More sophisticated caching can be implemented using custom implementations of SourceValidity.

Complete Example

There was an example here which didn't work with 2.1 M2-dev. I have updated and tested the Cocoon CVS example (file webapp/samples/xsp/xsp/cacheable.xsp), please refer to it for detailed info. -- BertrandDelacretaz

XSPCachingWithCocoonHEAD (last edited 2009-09-20 23:41:25 by localhost)