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 09:55:42 GMT
Leszek Gawron wrote:

> Sylvain Wallez wrote:
>> Leszek Gawron wrote:
>>> Sylvain Wallez wrote:
>>>>  <page jx:cache-key="" 
>>>> jx:cache-validity="">
>>> 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?
>> Two anwsers to this:
>> - we could add a builtin "createObject()" to the JXG expression 
>> language, thus directly solving your problem. I don't think this is a 
>> good idea as it opens the door to too much code in the template.
> I do not like it either.
>> - the NewsHelper object can be created in the flow and passed as 
>> viewData. This keeps things clean: the flow gives necessary data to 
>> the view, and the view pulls what it needs from that data, including 
>> means to compute the cache information.
> That's fine by me. It's nearly the same what I proposed (if not the 
> same). If somebody gave me some points I would like to implement some 
> version of it.
> Thinking out loud:
> 1. flow passes cache info to template via some object instance that 
> provides cache key and validity. It could be 2 objects (one for key 
> one for validity) but it looks like one object is cleaner (we could 
> impose some interface - is there one in cocoon already?)

What flow passes to the view is completely up to your choices.

> 2. There is CachingJXTemplateGenerator that extends the one we have now.
> 3. CJXTG implements getKey() and getValidity(). According to cocoon 
> docs if null is passed from these methods the result is not being 
> cached. So we could even modify the existing generator and have only 
> one that does caching or not.

Yep. No need for a cacheable extension.

> 4. "Compiled" page template has to hold 2 more values - cache key and 
> validity assuming the values are Jexl or JXpath expressions.


> 5. getValidity() and getKey() have access to the template and flow 
> bizData (via FlowHelper). When invoked they get appropriate 
> jexl(jxpath) expression and evaluate it against bizData. If there is 
> no jx:cache-key jx:validity defined then null is returned and no 
> caching is being performed.


> 6. voilla we have a jxtemplate that is very performant for sites 
> slashdot like  (I mean lots of reads, infrequent page updates).


> I would like to become an active contributor but the entry step is too 
> big without your help. I know it sounds a bit like a waste of time 
> talking some simple functionality over and then doing the review 
> instead of implementing it by oneself but if you choose the first 
> variant you'll have a new active contributor in some future (near I hope).

You also have to consider time: we often don't have the time to 
implement all the nice feature we discuss here, and new contributors are 
therefore very welcome.

So ask whatever you need to get started, we'll try to help you in your 
way inside the Cocoon internals. Others will certainly learn from that 
too. About caching, you may want to read a wiki page [1] explaining how 
the pipeline machinery works.



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

View raw message