I have a page where I list some products based on search data. The products shown are not saved in local database, but are taken live using API (and this is how it has to stay).
When page loads, it first lists products from one provider (first API call). After page finishes loading, then with Ajax the 2nd call to 2nd provider is made, product list comes and is appended to the page.
Considering each api call takes 2+ seconds to return data, I can't leave more than 1 call on page load.
My question is: How to do pagination in such scenario?
Doing static pagination: Pagination is done in browser. This is really simple, but on large result sets it might slow down the device, or even crash the page.
On first load, cache all results and do pagination using cache file (dificulty: medium, also it will not be ok to keep that cached file for too long, since data can change frequently)
No cache, pagination doen on server. Here I have no idea how to do it.
Things to consider
After figuring out the idea behind pagination, I'll also have to add filters and sorting.
Using php, mysql, js.