On Thu, Aug 08, 2013 at 11:51:47AM -0700, Bill Moseley wrote:
> I have a REST app that returns collections a page at a time.   So, part of
> that response is the Data::Page object.
> 
> There is some overhead with fetching the total_entires each time I query
> for the next page of results, and in my case it doesn't change frequently.
>   So, I'm thinking about caching.

Don't. It won't change frequrently until it does.

Instead bring in the total entries as a subselect via 
{ '+columns' => { tot_cnt => $orig_unpaged_rs->count_rs->as_query } }
and use $any_result_obj->get_column('tot_cnt') to populate the pager
tot count.

Cheers

_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk

Reply via email to