We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Pagination adapters and cache

Hey guys. I'm buiding my first web app with phalcon (and in general) and I have a confusion on how to arrange pagination for not very small (~20000 rows >20 columns) database. I've tried both Model and Query builder adapters, seems like Query builder is significantly faster.

However I can't use resultSet directly from Query builder pagination e.g. to show all row details on click (if I load only few columns for pagination) or to sort results without exec additional query. Is it correct?

I have plan B to use cached result set with Model pagination adapter. Is it good practice?

What is the best way(if there is) to use cache In case of a) Model b)Query builder adapter?

edited Apr '15

Allright If I'm doing caching via Apc cache and.

$QueryBuilder -> getQuery()-> cache(['key' => 'parts', 'lifetime' => 600])->execute();

While my query result rows count is about 5000 it seems to work, but don't give any significant perfomance boost. If I build query for all database records (no wheres) I get:

Allowed memory size of 134217728 bytes exhausted (tried to allocate 75 bytes)

And keep getting this kind of messages until I allocate 512MBs which make no sence as all my database weights ~40MB.