JXTG template caching with a dynamic cache key and NOP Validity

Single request parameter

This content has been generated at
'foo' request parameter: ${cocoon.request.parameters.foo}

Caching configuration is jx:cache-key="$ {cocoon.request.parameters.foo}" jx:cache-validity="$ {Packages.org.apache.excalibur.source.impl.validity.NOPValidity()}"

The content will be cached separately for each value of request parameter named 'foo'. Once the content is generated it never expires (unless the template source changes).

You may try to reload the page and see if generation date changes.
Try other 'foo' values: not defined, empty, bar, zoo and watch document generation date.

When the 'foo' parameter is not defined the page does NOT get cached.
This is because the whole cache-key has to evaluate to non null value.
If you to cache also this kind of request you have to modify your cache-key to always be not null.

Next sample: Caching with all request parameters.
Go Back to Cocoon Template samples.