Leszek Gawron wrote:

Upayavira wrote:

Leszek Gawron wrote:

Sylvain Wallez wrote:

<page jx:cache-key="news.id" jx:cache-validity="com.my.NewsHelper.getValidity(news.urgency)">



One question: if this NewsHelper is NOT an avalon component (or object instantiated by flow.createObject) then it doesn't have acces to any backend logic or data (for example database that stores expiration time for different news services). Would it be possible to instantiate this object via flow.createObject analogy?



Of course. You could equally well say:

sendPage("my-url", {"myObject", myAvalonObject});

<page jx-cache-key="myObject.getValidity()">

Regards, Upayavira

But that does not differ from what I proposed in first post and Sylvain wrote it is a bad idea.


Please read my last post. There's a subtle but very important difference: the cache information is computed *by the template* even if the information needed for that is given in the view data.

And this distinction is important, as that's in the template that we precisely know what constitutes the cache validity. Moreover, you may consider the case of complex pipelines where the actual template depends on the user rights, target browser or whatever else. In that case, the cache information can be different depending on used template.

So, in simple words: cache information is a concern of pipeline components, data needed to compute it can come from anywhere, including flowscript view data.

Sylvain

--
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }



Reply via email to