Hi,

Too often I find myself creating a searchSomething in the database and
storing the results in a memory cache.   This works fine for small sets
where I can fetch the entire result with minimum overhead but I may get into
trouble if the search result is too big.  So I have to add pagination
support.

The question is how to:
a) implement it efficiently
b) format the API

For the implementation I know there is Zend_Paginator and I will investigate
that and coupling with Zend_Cache.    If I understand correctly I'll to
perform the query two times.  One with a COUNT statement to get only the
maximum number of items and the second to retrieve the current (or selected
"page") of records.

But how about the API?

Should $c->searchSomething($queryParams) return just the number of items
(integer) and have another method $c->fetchPageResult($i) to get results
(array of objects) of the "page" being fetched?

Regards.

Reply via email to