I'm trying to make sure I understand issues surrounding multiple
concurrent users.  Take the example from
http://code.google.com/appengine/docs/python/datastore/transactions.html#Uses_For_Transactions

def increment_counter(key, amount):
  obj = db.get(key)
  obj.counter += amount
  obj.put()

The text makes it clear that a naive implementation like that is
susceptible to a collision between two concurrent users (meaning two
separate instances of the python script running at the same time).
The second put() clobbers the results of the first one.

I'm unclear on how memcache fits in.  If those two concurrent
instances both instead call cached_obj=memcache.get("my_key") and get
a result back from some earlier memcache.add("my_key", my_object), are
they susceptible to the same sort of collision if each instance does
something like cached_obj.counter += amount?

I kind of thought memcache worked seamlessly across instances, but I
don't see how in this case.

Thanks for any clarification you can provide.
--~--~---------~--~----~------------~-------~--~----~
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