0
votes

Im doing this standard procedure on my server, with a "@Cache" - Entity

  1. load entity, ObjectifyService.ofy().load().key(...)
  2. manipulate the entity
  3. save the entity, ObjectifyService.ofy().save().entity(...).now()

But when I look up in my appstat I find that there is never a successful load from the Memcache. Because I see a Get-Request to the Memcache followed by a Get-Request to the Datastore, all the time see it here. Meaning that the Memcache does not contain my entity, as I understand. The method is called every 10th seconds.

This is a similar discussion (without an answer for me) I found so far. https://groups.google.com/forum/#!topic/objectify-appengine/d-yzaNLJL4s

1
So my Question is: Why is there no successful "Memcache-Load" - Mira Stinktshir

1 Answers

1
votes

In order to ensure memcache stays consistent with your Cloud Datastore data, Objectify has the following rules:

  • On load(), first try to read from memcache. If that fails, read from Cloud Datastore and store in memcache.
  • On save(), invalidate the entity in memcache.

So if you always perform load() followed by save(), you'll never read the entity from memcache -- each request will always invalid your cache.