Reputation: 1317
First, I retrieve an object from memcache:
player = memcache.get('%s' % id)
Then I update one of its properties:
player.score = newScore
I've done a bit of testing and it seems as it these two lines change the property player.score in my datastore. Now, I don't know much about memcache, but I do not expect this behavior.
Thanks.
Upvotes: 0
Views: 140
Reputation: 9106
Since you are using Python, I think you are seeing the effect of NDB caching, specifically, the memcache-backed caching. So yes, the behavior is expected. Apparently not, since both the OP and the BDFL had said that the code is not using NDB.
Upvotes: 1
Reputation: 561
You want to save the changes after updating your player object, put it again to the datastore:
player.score = newScore
player.put()
Upvotes: 1