> Hi All,
> 
</snip>
> 
>     A user fills in a form which indicates that they want to 
> search for 
> "rocky mountains".  Upon submission of the form, the url that 
> is built 
> matches a cocoon pipeline which refers to a xsp to generate content. 
> The pipeline also enforces pagination with parameters for number of 
> items per page and the current page to view.  In the xsp, if 
> the query 
> already exists in the session then we should reuse the 
> results already 
> generated and stored if possible.  If the query is new the 
> results are 
> generated and added to the session.  The idea here is to not 
> recompute 
> query results when a user decides to view a second, third, or 
> even fifth 
> page of results.  

I suppose the query returns for example something like 50 results, and the user 
can browse through them, right?

Using sessions is certainly not the way to go in my opinion (somebody else with 
the same query is allowed to be served the very same results, so why use a 
session? Or is it session dependant, what you see)

Anyway, is the database changing, or is it static? If you just have a static 
database, then use the ExpiresCachingProcessingPipeline (and just cache the 
result as long as you want to). 
Do something like:

<!-- below caching or noncaching -->

<map:match pattern="results">
        <map:generate src="cocoon://go2expiringpart/gimeAllResults"/>
        <map:transform type="paginator> (or whatever you want to use)
                <map:parameter name="page" value="{request-param:page}"/>
        </map:transform>
        <map:serialize/>
</map:match>

<map:pipeline type="expires" internal-only="true">
    <map:parameter name="cache-expires" value="60"/>
    <map:parameter name="cache-key" 
value="{0}{request-param:allYourParamsWhichInfluenceSQL}"/>
    <map:match pattern="go2expiringpart/gimeAllResults">
        <map:generate src="site://queries/mysql/gimeAllResults.xml">
                <map:parameter name="query" value="{request-param:query}"/>
        </map:generate>
        <map:transform type="sql">
           <map:parameter name="use-connection" 
value="{globalconstants:mysql_name}"/>
         </map:transform>
         <map:serialize type="xml"/>
     </map:match>
 </map:pipeline>

See below for extra information,

Hope this helps.

Regards Ard

http://www.hippocms.org/display/CMS/How+to+cache+pipelines+for+a+certain+amount+of+time
http://www.hippocms.org/display/CMS/ExpiresCachingProcessingPipeline

-- 

Hippo
Oosteinde 11
1017WT Amsterdam
The Netherlands
Tel  +31 (0)20 5224466
-------------------------------------------------------------
[EMAIL PROTECTED] / http://www.hippo.nl
-------------------------------------------------------------- 

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

Reply via email to