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/12 13:43:30 UTC

implementing <>

Hi all,
 
How can I add caching to my custom written serializer? On average my
serializer takes 3 seconds to complete (regardless whether I implement the
cacheable interface or not)
 
 
My serializer implements 2 interfaces : Serializer and Cacheable. 
 
Implementation of the caching interface :
 
      public long generateKey() {
            //cachekey is long var
            //note that the svgserializer returns 1 here ????
            return cacheKey++;
      }
 
      /* 
       * @return
       */
      public CacheValidity generateValidity() {
            
            //stole this from the svgserializer
            return NOPCacheValidity.CACHE_VALIDITY;
      }
 
Is this implementation correct at all? What do I need to do more? My
serializer is doing some expensive remote calls and gets back binary data,
this is all fairly static though so caching would be in order.
 
Reading up on the docs, there seems to be an event-cache and stream-cache
available (http://cocoon.apache.org/2.0/userdocs/concepts/caching.html
<http://cocoon.apache.org/2.0/userdocs/concepts/caching.html> ) , should I
use these ?
 
Thanks
jorg

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


Re: implementing <>

Posted by Vadim Gritsenko <va...@verizon.net>.
Jorg Heymans wrote:

>Hi all,
> 
>How can I add caching to my custom written serializer? On average my
>serializer takes 3 seconds to complete (regardless whether I implement the
>cacheable interface or not)
> 
> 
>My serializer implements 2 interfaces : Serializer and Cacheable. 
> 
>Implementation of the caching interface :
> 
>      public long generateKey() {
>            //cachekey is long var
>            //note that the svgserializer returns 1 here ????
>            return cacheKey++;
>

You should read cacheable.xsp and after reading in also return "1" here.

(Otherwise you will return cahced response only on 2^64 request to the 
same resource)


Vadim


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