I have a client talking with server program(using sqlite3 as the storage) which needs to support paging. I am thinking about how to implement that. One approach:
1) user request page 1
a. execute query from sqlite3
b. return the first page range items to client
2) user request page N
a. execute query from sqlite3
b. return the N page range itmes to client
So in my approach every time user requests data I will re issue the query and get the specified elements, which seems waste of time...(comparing with caching all the items one time and just give the portion user asks, but this approach is more complex, as I need to timeout the cache - user is using browser I don't know when the user is loggout and the cache is useless)
Any better ideas?