HI,
    I somehow have the feeling that for pagination,   cursors,
memcache and task queues can be used. But I can't get my head around
to get the exact code. Any experts here who can help?

The idea is like this ..
First time the query runs do something like this

q=Something.all()
q.filter
.... and so on ...
total_results=q.count()
q.limit(20)   # say,
current_results=q.count()  # what if it only returned 15 at the end ?
self.response.out.write(" Showing " + str(current_results) + " of "
+str(total_results))

Add a task with current query as parameter(somehow, may be get some
kind of unique id for it or something) . The task should generate all
(or a set of next N*5) cursors ready in a memcached list(may be comma
seperated row)

The next time the cgi runs it should first check if there is a
memcached list of cursors for the current and next (and may be
previous) N set of pages .. if not ,  call the task again to generate
it. If it was existing , use the cursors from the memcached list.

the task could do something like this :

q=soemthing.all()
if cursor:
   q.with_cursor(cursor)
q.limit(20)
next_cursor=q.cursor()
add the cursor to cache with unique session/query id
rinse, repeat till satisfied.

what say?



if cursor:
    q.with_cursor(cursor)

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to