cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ard Schrijvers" <a.schrijv...@hippo.nl>
Subject RE: is it possible to cache sql queries?
Date Wed, 15 Mar 2006 11:15:08 GMT

> On Tue, 2006-03-14 at 23:04 +0100, Ard Schrijvers wrote:
> > > Yeah, good call.  I was actually thinking of something that could 
> > > override the caching on an entire pipeline.  Then it could be 
> > > used for 
> > > other things like grabbing rss feeds or something.  For example:
> > > 
> > > <map:pipeline type="forcedcaching">
> > >   <map:parameter name="expires" value="access plus 1 hours"/>
> > >   ...
> > > </map:pipeline>
> > > 
> > 
> > Don't build it yourself!! There is just a pipeline exactly 
> doing what you want: Use the exiring pipeline:
> > 
> > <map:pipe logger="sitemap.pipes.expires" name="expires" 
> src="org.apache.cocoon.components.pipeline.impl.ExpiresCaching
> ProcessingPipeline">
> >     <parameter name="cache-expires" value="180"/> <!-- 
> default cache time = 3 min -->
> > </map:pipe>
> > 
> > Now use :
> > <map:pipeline  type="expires" internal-only="false">
> >      <map:parameter name="cache-key" value="{define your 
> own cache key here: if you leave it empty the url without 
> request-params will be used as cache-key}"/>
> >      <map:parameter name="cache-expires" value="60"/> <!-- 
> override here your default expire -->
> >   <map:match .... 
> > 	your matchers here...
> > 
> > That is all: 
> > 
> > In the cache-key you can also take request-params like:  
> <map:parameter name="cache-key" 
> value="{0}-{request-param:page}" /> <!-- {0} = pipeline -->
> > 
> > There is certainly no need to write your own caching mechanism for
> > this...if this cached result is not returned fast enough 
> from cocoon,
> > since cache-key lookups and validity checks are still done we have a
> > (probably not yet committed to cocoon) version of the
> > ExpiresCachingProcessingPipeline performing MUCH faster for complex
> > pipelines. 
> 
> This is interesting, I have been thinking about something like that
> myself. Any chance of contributing it to Cocoon?

I will ask around here if we have already committed it (otherwise, we will do so soon I am
pretty sure)

Anyway, attached (hope it works to attach, otherwise will mail its plain text) is the ExpiresCachingProcessingPipelineNew
you can use. This one actually is capable of delivering 1000 hits a sec on cocoon on pretty
modest hardware, which is regardless the complexitity of the pipelines it caches (the old
one does not perform well because it initializes still all included pipes testing for validities
and cache keys, while, for the expiring pipeline you already know this: You define the cachekey
yourself AND you say how long it is valid.) 

Regards AS


> 
> -- 
> Bruno Dumon                             http://outerthought.org/
> Outerthought - Open Source, Java & XML Competence Support Center
> bruno@outerthought.org                          bruno@apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
> 

Mime
View raw message