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.

I would say it is different, in as much as previously you calculated the validity in flowscript. Now, you pass in an object, and the template asks the object for its validity. So the object itself knows how to decide whether it is valid or not, which seems quite reasonable to me.


Adding that level of complexity to flowscript can make your flowscripts very complex very quickly. That is what I believe Sylvain is objecting to.

Regards, Upayavira





Reply via email to