[Catalyst] Pager and Cache

Bill Moseley moseley at hank.org
Mon May 19 22:45:09 BST 2008

On Mon, May 19, 2008 at 05:57:26PM +0200, Emmanuel Quevillon wrote:
> Hi,
> I don't know if this question have been already sent or not 
> but I am wondering if it is possible to sort cache a pager 
> into the catalyst application to be able to quickly get 
> results from a query that would have been cached.
> More explanation :
> I read in Jrock's book that a pager is quite easy to 
> implement using $rs->page() and a page parameter in the 
> query url to display results. However, this example (and 
> method) obligate to redo the query search each time the user 
> ask for the next, previous or last page. In the case the 
> request takes a very long time, navigate through results 
> start to be a pain. So is there a solution or would it be 
> reasonable to think of caching the pager in the catalyst 
> application to directly access each pages without requesting 
> the database for the same query?

If the page does not change when going to "previous" then maybe what
you really need is to simply set caching headers so the client
(browser) will cache the page.  Set Expires short and if you need
control use a cache-busting query parameter that you can change when
you want to force a real page fetch.

Bill Moseley
moseley at hank.org

More information about the Catalyst mailing list