com.googlecode.objectify.cache
Class EntityMemcache.Bucket

java.lang.Object
  extended by com.googlecode.objectify.cache.EntityMemcache.Bucket
Enclosing class:
EntityMemcache

public class EntityMemcache.Bucket
extends java.lang.Object

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
EntityMemcache.Bucket(com.google.appengine.api.datastore.Key key)
          Crate a bucket with an uncacheable key.
EntityMemcache.Bucket(com.google.appengine.api.datastore.Key key, com.google.appengine.api.memcache.MemcacheService.IdentifiableValue iv)
           
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 com.google.appengine.api.datastore.Entity getEntity()
          Get the entity stored at this bucket, possibly the one that was set
 com.google.appengine.api.datastore.Key getKey()
           
 int hashCode()
           
 boolean isCacheable()
           
 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.
 boolean isNegative()
           
 void setNext(com.google.appengine.api.datastore.Entity value)
          Prepare the value that will be set in memcache in the next putAll().
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EntityMemcache.Bucket

public EntityMemcache.Bucket(com.google.appengine.api.datastore.Key key)
Crate a bucket with an uncacheable key. Same as this(key, null).


EntityMemcache.Bucket

public EntityMemcache.Bucket(com.google.appengine.api.datastore.Key key,
                             com.google.appengine.api.memcache.MemcacheService.IdentifiableValue iv)
Parameters:
iv - can be null to indicate an uncacheable key
Method Detail

getKey

public com.google.appengine.api.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.appengine.api.datastore.Entity getEntity()
Get the entity stored at this bucket, possibly the one that was set


setNext

public void setNext(com.google.appengine.api.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.


equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object


Copyright © 2011 Jeff Schnitzer and a gang of pirates. All Rights Reserved. Build version: 3.1