com.googlecode.objectify
Class ObjectifyOpts

java.lang.Object
  extended by com.googlecode.objectify.ObjectifyOpts
All Implemented Interfaces:
java.lang.Cloneable

public class ObjectifyOpts
extends java.lang.Object
implements java.lang.Cloneable

The options available when creating an Objectify instance.

The default options are:

Author:
Jeff Schnitzer

Constructor Summary
ObjectifyOpts()
           
 
Method Summary
 ObjectifyOpts clone()
          Make a copy of this object as-is.
 boolean getBeginTransaction()
          Gets the current value of beginTransaction
 com.google.appengine.api.datastore.ReadPolicy.Consistency getConsistency()
          Gets the initial consistency setting for the Objectify instance
 java.lang.Double getDeadline()
          Gets the deadline for datastore calls, in seconds
 boolean getGlobalCache()
          Gets whether or not the Objectify instance will use a 2nd-level memcache
 boolean getSessionCache()
          Gets whether or not the Objectify instance will maintain a session cache
 ObjectifyOpts setBeginTransaction(boolean value)
          Sets whether or not the Objectify instance will start a transaction.
 ObjectifyOpts setConsistency(com.google.appengine.api.datastore.ReadPolicy.Consistency value)
          Sets the initial consistency value for the Objectify instance.
 ObjectifyOpts setDeadline(java.lang.Double value)
          Sets a limit, in seconds, for datastore calls.
 ObjectifyOpts setGlobalCache(boolean value)
          Sets whether or not the Objectify instance will use a 2nd-level memcache.
 ObjectifyOpts setSessionCache(boolean value)
          Sets whether or not the Objectify instance will maintain a session cache.
 ObjectifyOpts setTransactionOptions(com.google.appengine.api.datastore.TransactionOptions opts)
          Set options for a transaction to start, or null for no transaction.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectifyOpts

public ObjectifyOpts()
Method Detail

getBeginTransaction

public boolean getBeginTransaction()
Gets the current value of beginTransaction


setBeginTransaction

public ObjectifyOpts setBeginTransaction(boolean value)
Sets whether or not the Objectify instance will start a transaction. If true, the instance will hold a transaction that must be rolled back or committed. Uses XG transactions when on the HRD; setBeginTransaction(true) is equivalent to setTransactionOptions(TransactionOptions.Builder.withXG(true)). There is no overhead for XG transactions on a single entity group, so there is no good reason to ever have this false.


setTransactionOptions

public ObjectifyOpts setTransactionOptions(com.google.appengine.api.datastore.TransactionOptions opts)
Set options for a transaction to start, or null for no transaction. You probably want to use setBeginTransaction(true) instead.


getSessionCache

public boolean getSessionCache()
Gets whether or not the Objectify instance will maintain a session cache


setSessionCache

public ObjectifyOpts setSessionCache(boolean value)
Sets whether or not the Objectify instance will maintain a session cache. If true, all entities fetched from the datastore (or the 2nd level memcache) will be stored as-is in a hashmap within the Objectify instance. Repeated get()s or queries for the same entity will return the same object.


getGlobalCache

public boolean getGlobalCache()
Gets whether or not the Objectify instance will use a 2nd-level memcache


setGlobalCache

public ObjectifyOpts setGlobalCache(boolean value)
Sets whether or not the Objectify instance will use a 2nd-level memcache. If true, Objectify will obey the @Cached annotation on entity classes, saving entity data to the GAE memcache service. Fetches from the datastore for @Cached entities will look in the memcache service first. This cache is shared across all versions of your application across the entire GAE cluster.


getConsistency

public com.google.appengine.api.datastore.ReadPolicy.Consistency getConsistency()
Gets the initial consistency setting for the Objectify instance


setConsistency

public ObjectifyOpts setConsistency(com.google.appengine.api.datastore.ReadPolicy.Consistency value)
Sets the initial consistency value for the Objectify instance. See the Appengine Docs for an explanation of Consistency.


getDeadline

public java.lang.Double getDeadline()
Gets the deadline for datastore calls, in seconds


setDeadline

public ObjectifyOpts setDeadline(java.lang.Double value)
Sets a limit, in seconds, for datastore calls. If datastore calls take longer than this amount, an exception will be thrown.

Parameters:
value - can be null to indicate no deadline (other than the standard whole request deadline of 30s).

clone

public ObjectifyOpts clone()
Make a copy of this object as-is.

Overrides:
clone in class java.lang.Object


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