Le 19 mai 08 à 17:57, Emmanuel Quevillon a écrit :
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?
Hi,
Caching the pager won't work, I think. I would cache the array
returned by $rs->all and use directly Data::Page (which is used
internally by DBIx::Class IIRC). Be careful though, $rs->all will
fetch all data from the DB for your query, so you might want to a)
limit the total number of rows returned and b) clean this data up at
some point.
Hope that helps,
--
Matthieu
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/