cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ard Schrijvers" <>
Subject RE: Session Buffet
Date Wed, 07 Jun 2006 07:52:38 GMT

> Hi All,
>     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: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:transform type="sql">
           <map:parameter name="use-connection" value="{globalconstants:mysql_name}"/>
         <map:serialize type="xml"/>

See below for extra information,

Hope this helps.

Regards Ard


Oosteinde 11
1017WT Amsterdam
The Netherlands
Tel  +31 (0)20 5224466
------------------------------------------------------------- /

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message