Class EntityMemcache.Bucket

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

public class EntityMemcache.Bucket
extends 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

    Constructors
    Constructor
    Description
    Bucket​(com.google.appengine.api.datastore.Key key)
    Crate a bucket with an uncacheable key.
    Bucket​(com.google.appengine.api.datastore.Key key, com.google.appengine.api.memcache.MemcacheService.IdentifiableValue iv)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    com.google.appengine.api.datastore.Entity
    Get the entity stored at this bucket, possibly the one that was set
    com.google.appengine.api.datastore.Key
     
    boolean
     
    boolean
    "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
     
    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, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Bucket

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

      public 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 Details

    • 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.