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 Tue, 14 Mar 2006 22:04:59 GMT

> 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.ExpiresCachingProcessingPipeline">
    <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. But in your case, the one present now should
do it!

Regards AS



> But unfortunately, this is a little beyond my abilities at 
> the moment.  
> I'm still trying to figure out simple things with cocoon (and 
> have been 
> doing so for a number of months now).  So I won't be looking into 
> anything like this for quite a while.
> 
> Thanks for the thoughts though everyone!
> Brian
> 
> 
> Torsten Curdt wrote:
> 
> > You could extend the transformer and hook in your caching strategy.
> > Have a look at other transformers that are cacheable how to do this.
> >
> >> AFAIK, the SQL tranformer is not cacheable.
> >>
> >> Best Regards,
> >>
> >> Antonio Gallardo.
> >>
> >> Brian Maddy wrote:
> >>
> >>> Does anyone know if it is possible to cache sql queries?  
> I'm  using 
> >>> the sql transformer a lot and many of the queries don't 
> need  to be 
> >>> done more than once every few hours.  But they're being done  all 
> >>> the time.  Is it possible to cache the results somehow with  
> >>> cocoon's caching system?
> >>
> >
> > cheers
> > -- 
> > Torsten
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.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