cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <>
Subject Re: JXTG and caching
Date Tue, 01 Jun 2004 08:48:14 GMT
Bertrand Delacretaz wrote:

> Le 1 juin 04, à 10:09, Sylvain Wallez a écrit :
>> ...Well, it _could_ have a chance to work, but flowscript is 
>> definitely not the appropriate location to compute cache information 
>> for an element of the view pipeline....
> flowscript maybe not but how about backend java code?
> Use-case: for a news site, you might want the cache validity to be 
> dependent on the "urgency" of the news, for example cache older news 
> for a longer time, assuming they won't change much anymore.
> In this case the cache validity (or at least hints to the appropriate 
> validity range) needs to come from the backend.
>> ...So what about adding two optional attributes on the template's 
>> root element, defining the cache information?
>> <page
>>    xmlns:jx=""
>>    jx:cache-key='${cocoon.request.get("abc") + "!!spacer!!" + 
>> cocoon.request.get("bcd")....'
>>    jx:cache-validity='${new DeltaTimeCacheValidity(60 * 60 * 24)}'>
>>    ... template ....
>> </page>
> I like the idea, and IIUC it would also allow the Flow to receive the 
> DeltaTimeCacheValidity (for example) from your java code and pass it 
> down to JXTG, right?
>     jx:cache-validity='${someObjectComingFromJavaCodeViaFlow}'>
> Or, in other words, do you see this as having access to any additional 
> variables passed in the cocoon.sendPage call?

Sure. Since the expression is evaluated, you can access any information 
that is needed, and also some backend code.

Taking your example of news urgency, the corresponding algorithm would 
certainly not fit into a single attribute (because of the "if" 
constructs it's likely to contain), but could simply be written as :

  <page jx:cache-key="" 

Moreover, I find that being limited to a single attribute enforces good 
SoC by forbidding complicated code in the template.


Sylvain Wallez                                  Anyware Technologies 
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }

View raw message