Package com.googlecode.objectify.cache
Class CachingAsyncDatastore
java.lang.Object
com.googlecode.objectify.cache.CachingAsyncDatastoreReaderWriter
com.googlecode.objectify.cache.CachingAsyncDatastore
- All Implemented Interfaces:
AsyncDatastore
,AsyncDatastoreReaderWriter
public class CachingAsyncDatastore
extends CachingAsyncDatastoreReaderWriter
implements AsyncDatastore
A write-through memcache for Entity objects that works for both transactional and nontransactional sessions.
- Caches negative results as well as positive results.
- Queries do not affect the cache in any way.
- Transactional reads bypass the cache, but successful transaction commits will update the cache.
- This cache has near-transactional integrity. As long as DeadlineExceededException is not hit, cache should not go out of sync even under heavy contention.
Note: Until Google adds a hook that lets us wrap native Futureinvalid input: '<'?> implementations,
you muse install the AsyncCacheFilter
to use this cache asynchronously. This
is not necessary for synchronous use of CachingDatastoreService
, but asynchronous
operation requires an extra hook for the end of a request when fired-and-forgotten put()s
and delete()s get processed. If you use this cache asynchronously, and you do not
use the AsyncCacheFilter
, your cache will go out of sync.
- Author:
- Jeff Schnitzer invalid input: '<'[email protected]>
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
get
(Collection<com.google.cloud.datastore.Key> keys, com.google.cloud.datastore.ReadOption... options) newTransaction
(Runnable afterCommit) Methods inherited from class com.googlecode.objectify.cache.CachingAsyncDatastoreReaderWriter
delete, put, run, runAggregation
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.googlecode.objectify.impl.AsyncDatastoreReaderWriter
delete, get, put, put, run, runAggregation
-
Constructor Details
-
CachingAsyncDatastore
-
-
Method Details
-
empty
- Specified by:
empty
in classCachingAsyncDatastoreReaderWriter
-
newTransaction
- Specified by:
newTransaction
in interfaceAsyncDatastore
-
get
public Future<Map<com.google.cloud.datastore.Key,com.google.cloud.datastore.Entity>> get(Collection<com.google.cloud.datastore.Key> keys, com.google.cloud.datastore.ReadOption... options) - Specified by:
get
in interfaceAsyncDatastoreReaderWriter
-