How does caching works with App Engine? Is it enough just to add the @Cached annotation:
@Cached
public class MyEntity {
@Id Long id;
...
}
However, from Objectify docs:
“Objectify’s global cache support prior to v3.1 suffered from synchronization problems under contention. Do not use it for entities which require transactional integrity, and you are strongly advised to apply an expiration period to all cache values.”
Does it mean that if I have a code that have this form below I should not use it?
DAOT.repeatInTransaction(new Transactable() {
@Override
public void run(DAOT daot)
{
Counter count = daot.ofy().find(Counter.class, COUNTER_ID);
count.increment();
daot.ofy().put(count);
}
});
Objectify tries as hard as it can to make its global cache support as transactional as possible:
If your request or task runs right up against the deadline limit, for example, there is a possibility that a write could make it to the datastore but not update the cache: