You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Jorg Heymans <Jo...@12snap.com> on 2003/06/13 10:38:04 UTC

RE: implementing <> [SOLUTION]

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:vadim.gritsenko@verizon.net] 
Sent: Donnerstag, 12. Juni 2003 21:00
To: cocoon-users@xml.apache.org
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: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org


[PATCH] Re: implementing <>

Posted by Jorg Heymans <jh...@coeno.com>.
Hi Joerg,

Attached is a patch against cvs 2.0.5. It implements a caching directory 
generator the same way cocoon 2.1 does. An additional sitemap parameter 
"refreshDelay" is used to check the timestamps of the files 
periodically. If i should upload this into the patch queue on bugzilla 
let me know.

Hope This Helps (tm)
:)
Jorg

Joerg Heinicke wrote:

> Hello Jorg,
>
> the caching for the DirectoryGenerator was implemented on 13th of May 
> in Cocoon 2.1: 
> http://cvs.apache.org/viewcvs.cgi/cocoon-2.1/src/java/org/apache/cocoon/generation/DirectoryGenerator.java 
>
>
> Is it correct that you did it for Cocoon 2.0? Can you compare your 
> caching with the one implemented in 2.1? And maybe provide a patch?
>
> Thanks,
>
> Joerg
>
> Jorg Heymans wrote:
>
>> 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
>
>

Re: implementing <> [SOLUTION]

Posted by Joerg Heinicke <jo...@gmx.de>.
Hello Jorg,

the caching for the DirectoryGenerator was implemented on 13th of May in 
Cocoon 2.1: 
http://cvs.apache.org/viewcvs.cgi/cocoon-2.1/src/java/org/apache/cocoon/generation/DirectoryGenerator.java

Is it correct that you did it for Cocoon 2.0? Can you compare your caching 
with the one implemented in 2.1? And maybe provide a patch?

Thanks,

Joerg

Jorg Heymans wrote:
> 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

-- 

System Development
VIRBUS AG
Fon  +49(0)341-979-7419
Fax  +49(0)341-979-7409
joerg.heinicke@virbus.de
www.virbus.de


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org