0
votes

Another newbie to GAE & objectify question.

I have a Game entity

player1
player2
gameOutcome
gameDate
gameDetails
etc

I need to query based on player and game outcome, then sort the returned (1 - 400 items) by date. The list ( a summary of each game) will be displayed 15 at a time. I need to save the sorted list to both get to the next page to be displayed and to a details page for each game. the memcache can have the Game instances but is there anyway to get the sorted list to persist somewhere ?

1

1 Answers

1
votes

The AppEngine datastore (and objectify) can return a query result to you with a "cursor," so you can get 15 items and then also this "cursor" object that will let you get the next 15 objects. You'll need to specify an "index" in appengine-indexes.xml on player, game outcome, sorted by date. After that, Objectify can handle the query itself (including paging) for you automatically.

After you get that working you can try to optimize by caching the results in memcache, but I'd tackle that separately if I were you.