Revision created by MOE tool push_codebase.
[gae.git] / java / src / main / com / google / appengine / api / datastore / EntityCachePolicy.java
blob4ccca37288726ff0eec91344473bca1e3c49550e
1 package com.google.appengine.api.datastore;
3 /**
4 * This class specifies datastore specific entity caching policies.
5 * <p>
6 * See {@link EntityCacheConfig} for details on how to configure entity caching for the datastore.
8 */
9 enum EntityCachePolicy {
11 /**
12 * Specifies that entities associated with this policy will be cached in the entity cache.
13 * However, on cache misses the entities will be retrieved from the datastore. And every entity
14 * creation, update, or deletion will also be persisted in the datastore.
16 * The datastore operations that benefit from this policy are {@link DatastoreService#get} and
17 * {@link AsyncDatastoreService#get}. These operations (when executed outside of a transaction)
18 * will first attempt to find the entities in the entity cache. And only when that fails will an
19 * attempt be made to find the entities in the datastore. When there is a high cache hit rate
20 * this will reduce the number of datastore read operations and also reduce the overall
21 * entity retrieval latency.
23 * With this policy, the datastore updates the entity cache in a way to minimize the chances
24 * of stale entities being returned from the cache, but it does not completely eliminate the
25 * possibility of stale entities being returned. For this reason, any entity reads done within
26 * a transaction bypass the cache. However, for all other entity reads the application code
27 * should tolerate stale entities being returned when entity caching is enabled.
29 CACHE,
31 /**
32 * Specifies that entities associated with this policy will only be retrieved from and
33 * persisted to the entity cache. The following datastore operations will not be invoked
34 * for the associated entities:
35 * <ul>
36 * <li>{@link DatastoreService#put}, {@link AsyncDatastoreService#put}
37 * <li>{@link DatastoreService#get}, {@link AsyncDatastoreService#get}
38 * <li>{@link DatastoreService#delete}, {@link AsyncDatastoreService#delete}
39 * </ul>
40 * Only entities with complete keys will be put into the entity cache. All other entities on
41 * which a put operation is performed will not be written to the entity cache and the keys
42 * for those entities will not be completed.
44 CACHE_ONLY