Memcache!
... wouldnt we all! I'm not sure its been determined that a 'true'
solution exists. ;P
Or at least a simple one. And one that works on massive datasets, like
AppEngine is meant to support.
Coming from mysql, its easy to think paging is a simple issue. Just
use a Count(*) and LIMIT on the queries. But that doesn't scale, its
horribly slow (but usually fast enough on small datasets)
In fact it reminds me of a saying I recently saw in a book:
"Fast, Accurate, Simple: pick any two"
Also re the 'previous' page link, memcache (again)! Store the 'cursor'
of each page in memcache (as you calculate it), and then on a page,
you can check memcache for cursor you need for the back link.