Package com.googlecode.objectify.cache
Class EntityMemcache.Bucket
java.lang.Object
com.googlecode.objectify.cache.EntityMemcache.Bucket
- Enclosing class:
EntityMemcache
A bucket represents memcache information for a particular Key. It might have an entity,
it might be a negative cache result, it might be empty.
Buckets can be hash keys; they hash to their Key value.
-
Constructor Summary
ConstructorsConstructorDescriptionBucket(com.google.cloud.datastore.Key key) Crate a bucket with an uncacheable key.Bucket(com.google.cloud.datastore.Key key, IdentifiableValue identifiableValue) -
Method Summary
Modifier and TypeMethodDescriptioncom.google.cloud.datastore.EntityGet the entity stored at this bucket, possibly the one that was setcom.google.cloud.datastore.KeygetKey()booleanbooleanisEmpty()"Empty" means we don't know the value - it could be null, it could be uncacheable, or we could have some really weird unknown data in the cache.booleanvoidsetNext(com.google.cloud.datastore.Entity value) Prepare the value that will be set in memcache in the next putAll().
-
Constructor Details
-
Bucket
public Bucket(com.google.cloud.datastore.Key key) Crate a bucket with an uncacheable key. Same as this(key, null). -
Bucket
- Parameters:
identifiableValue- can be null to indicate an uncacheable key
-
-
Method Details
-
getKey
public com.google.cloud.datastore.Key getKey() -
isCacheable
public boolean isCacheable()- Returns:
- true if we can cache this bucket; false if the key isn't cacheable or the memcache was down when we created the bucket
-
isNegative
public boolean isNegative()- Returns:
- true if this is a negative cache result
-
isEmpty
public boolean isEmpty()"Empty" means we don't know the value - it could be null, it could be uncacheable, or we could have some really weird unknown data in the cache. Basically, anything other than "yes we have an entity/negative" is considered empty.- Returns:
- true if this is empty or uncacheable or something other than a nice entity or negative result.
-
getEntity
public com.google.cloud.datastore.Entity getEntity()Get the entity stored at this bucket, possibly the one that was set -
setNext
public void setNext(com.google.cloud.datastore.Entity value) Prepare the value that will be set in memcache in the next putAll(). Null (or not calling this method) will put a negative result in the cache.
-