Every action on my app will require the user to view and update their user 
object, but other users will have the opportunity to update other user 
objects as well.  So, my question is, what is the cheapest way to do this?

The best way I have found to do this is:
1) read user from memcache (or datastore if not
 there and put into memcache)
2) modify user object
3) get from memcache again and see if version has changed
4) write to memcache with new version or throw error if version is different
5) have a cron job write batches to the datastore if needed

Most of the time a user will end up with 2 gets from memcache and 1 set to 
memcache.

The other option I have tried was transactions, but that was way too 
expensive -- datastore writes on every request.
I also tried sessions, but that was also very expensive -- datastore writes 
on every request.

Does anyone have a better solution?

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

Reply via email to