OK I understand the caching now a lot better. Anyone wanting to understand
how to implement his own caching should read

http://wiki.cocoondev.org/Wiki.jsp?page=WritingForCacheEfficiency
http://cocoon.apache.org/2.0/userdocs/concepts/caching.html

Note that in order for your serializer caching to work, the generator has to
implement cacheable as well because cocoon attempts to cache as far into the
pipeline as it can! If the start of the pipeline is already not cacheable
then the rest won't be either! This was the problem for me all along it
seems.

The often used file generator is cacheable, the directorygenerator I was
using is *not*. So I extended the existing DirectoryGenerator with a
CachingDirectoryGenerator implementing Cacheable.  I implemented the
interface methods, reconfigured sitemap and voila my content is delivered
fully cached now in 100ms instead of 3s!!

Thanks again for your help Vladim, I hope this thread has helped other
people as well in understanding cocoon's caching mechanism.


Greetings
Jorg

-----Original Message-----
From: Vadim Gritsenko [mailto:[EMAIL PROTECTED] 
Sent: Donnerstag, 12. Juni 2003 21:00
To: [EMAIL PROTECTED]
Subject: Re: implementing <<Cacheable>>

Jorg Heymans wrote:

>Good pointer thanks Vladim :-)
> 
>The difference with the xsp page ofcourse is that I cannot access the
>requestparameters from within the serializer.
>

And you should not.


>As a matter of fact the
>generatekey and cachevalidity gets called before anything else in the
>serializer, so I can't generate a key based on the content that is being
>processed.
>

And you should not.


>This would be the solution though. 
> 
>On a different note, if I put in a DeltaTimeCacheValidity(0, 5); and
>generate "1" as key this does not affect the performance of my serializer.
>It keeps executing at a steady "uncached" 3 seconds.
> 
>Any ideas on how to access request parameters within the serializer,
>

You don't need request parameters there. The only thing which must 
affect cache key generated by serializer is *serializer's state.*

Suppose you have one serializer and it's behavior is different in AM and 
PM (it's got two states). Then, you have to generate the key depending 
on time of the day:

    if (isAM) { return "1" } else { return "2" };

That's it. No request parameters. No content. Only component's state 
matters here. Request parameters, session attributes, etc, all taken 
care of well before seializer is called.


>maybe I
>can use a <map:param> on the serializer in the sitemap maybe?
>  
>

No. <serialize/> tag can't have params.

Vadim



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to