On Mon, 2006-09-18 at 09:33 +0200, Niels van Kampenhout wrote: > Leszek Gawron wrote: > > Thorsten Scherler wrote: > >> Hi all, hi Ard, > >> > >> http://marc.theaimsgroup.com/?l=xml-cocoon-users&m=115194685214066&w=2 > >> "... > >>>> Now, the cached jx would depend on these three parameters. > >>> Very easy to use, and less error prone than the flow part. > >>>> If somebody is interested in the code I will hear " > >> > >> Yes very interested. > >> http://svn.apache.org/viewvc?view=rev&rev=446701 > >> https://issues.apache.org/jira/browse/FOR-931 > >> > >> Can you attach a patch to this issue or commit it to cocoon directly? > >> > >> Would be awesome. > > Do I get it right: > > > > you want to patch JXTG to automatically build up a cache key from cocoon > > parameters? > > > > <map:match pattern="foo"> > > <map:generate src="foobar.jx"> > > <map:parameter name="foo" value="bar"/> > > <map:parameter name="bar" value="foo"/> > > </map:generate> > > <map:serialize/> > > </map:match> > > > > so cocoon:/foo gets cached with something like "foo=bar&bar=foo"? > > > > Why need a patch for that? After all you already have jx:cache-key and > > jx:cache-validity. > > > > Since Ard is on holiday until the GetTogether, I'll try to answer this > question. > > The reason is, as Ard said, to make it less error prone. People easily > make mistakes if they have to build a cachekey string themselves, en > they also easily forget to actually put the jx:cache-key and > jx:cache-validity attributes in the JX template. I am talking from > experience!
Especially if one uses jx for pure presentation logic. The usecase in forrest is that we use jx for the structurers (which are part of the dispatcher). Meaning if we force the user to add above tags in the jx:template, we will spend our days in answering the user mails that forgot to add it or do not know how to do it, ... > > It also makes the code more readable/transparent/explicit, because you > don't need the extra flow step anymore in many cases. Like stated in the subject, we do not even use flow and adding flow only for caching I consider kind of stupid. Can you give a hint how to do it? Is it as simple as adding the params to the cache key? If so would one use an aggregate validity since one would need to add all <jx:import>'s to the validity object. I just wrapped up the caching in the dispatcher and I reckon the jx generator would need a similar patch like http://svn.apache.org/viewvc?view=rev&revision=447311 (see DispatcherTransformer.java) http://svn.apache.org/viewvc/forrest/trunk/whiteboard/plugins/org.apache.forrest.plugin.internal.dispatcher/src/java/org/apache/forrest/dispatcher/transformation/DispatcherTransformer.java?r1=446701&r2=447311&pathrev=447311&diff_format=h TIA salu2 > > Regards, > Niels > -- thorsten "Together we stand, divided we fall!" Hey you (Pink Floyd)