I am using objectify on appengine with the java runtime. I am also using memcache via the @Cached annotation for several entities. My question is about the behavior of the objectify when putting objects into the datastore. When putting an entity that has the @Cached annotation, is the memcache updated? Or any existing cached data for that entity now out of sync with the datastore. I would like to have the memcache updated when I put an object into the datastore, however I don’t know if objectify does this by default or if I need to write this myself. If the memcache is updated, then I can have a much higher expiration time(or no expiration) for my data. FYI I am not using transactions.
Share
When you use @Cached, Objectify handles all updates to the memcache for you in a near-transactionally safe manner. It’s “near-transactional” because while it won’t fall apart under contention, there are rare circumstances under which it could go out of sync – for example, if you hit a DeadlineExceededException or OutOfMemoryException and Google terminates your VM.
Long expiration times are reasonable for most types of cached data.