App Engine Python SDK  v1.6.9 rev.445
The Python runtime is available as an experimental Preview feature.
Public Member Functions | Static Public Member Functions | List of all members
google.appengine.ext.ndb.context.Context Class Reference
Inheritance diagram for google.appengine.ext.ndb.context.Context:

Public Member Functions

def __init__
 
def flush
 
def get_cache_policy
 
def set_cache_policy
 
def get_memcache_policy
 
def set_memcache_policy
 
def get_datastore_policy
 
def set_datastore_policy
 
def set_memcache_timeout_policy
 
def get_memcache_timeout_policy
 
def get
 
def put
 
def delete
 
def allocate_ids
 
def get_indexes
 
def map_query
 
def iter_query
 
def transaction
 
def in_transaction
 
def call_on_commit
 
def clear_cache
 
def memcache_get
 
def memcache_gets
 
def memcache_set
 
def memcache_add
 
def memcache_replace
 
def memcache_cas
 
def memcache_delete
 
def memcache_incr
 
def memcache_decr
 
def urlfetch
 

Static Public Member Functions

def default_cache_policy
 
def default_memcache_policy
 
def default_datastore_policy
 
def default_memcache_timeout_policy
 

Member Function Documentation

def google.appengine.ext.ndb.context.Context.call_on_commit (   self,
  callback 
)
Call a callback upon successful commit of a transaction.

If not in a transaction, the callback is called immediately.

In a transaction, multiple callbacks may be registered and will be
called once the transaction commits, in the order in which they
were registered.  If the transaction fails, the callbacks will not
be called.

If the callback raises an exception, it bubbles up normally.  This
means: If the callback is called immediately, any exception it
raises will bubble up immediately.  If the call is postponed until
commit, remaining callbacks will be skipped and the exception will
bubble up through the transaction() call.  (However, the
transaction is already committed at that point.)
def google.appengine.ext.ndb.context.Context.clear_cache (   self)
Clears the in-memory cache.

NOTE: This does not affect memcache.
def google.appengine.ext.ndb.context.Context.default_cache_policy (   key)
static
Default cache policy.

This defers to _use_cache on the Model class.

Args:
  key: Key instance.

Returns:
  A bool or None.
def google.appengine.ext.ndb.context.Context.default_datastore_policy (   key)
static
Default datastore policy.

This defers to _use_datastore on the Model class.

Args:
  key: Key instance.

Returns:
  A bool or None.
def google.appengine.ext.ndb.context.Context.default_memcache_policy (   key)
static
Default memcache policy.

This defers to _use_memcache on the Model class.

Args:
  key: Key instance.

Returns:
  A bool or None.
def google.appengine.ext.ndb.context.Context.default_memcache_timeout_policy (   key)
static
Default memcache timeout policy.

This defers to _memcache_timeout on the Model class.

Args:
  key: Key instance.

Returns:
  Memcache timeout to use (integer), or None.
def google.appengine.ext.ndb.context.Context.get (   self,
  key,
  ctx_options 
)
Return a Model instance given the entity key.

It will use the context cache if the cache policy for the given
key is enabled.

Args:
  key: Key instance.
  **ctx_options: Context options.

Returns:
  A Model instance if the key exists in the datastore; None otherwise.
def google.appengine.ext.ndb.context.Context.get_cache_policy (   self)
Return the current context cache policy function.

Returns:
  A function that accepts a Key instance as argument and returns
  a bool indicating if it should be cached.  May be None.
def google.appengine.ext.ndb.context.Context.get_datastore_policy (   self)
Return the current context datastore policy function.

Returns:
  A function that accepts a Key instance as argument and returns
  a bool indicating if it should use the datastore.  May be None.
def google.appengine.ext.ndb.context.Context.get_memcache_policy (   self)
Return the current memcache policy function.

Returns:
  A function that accepts a Key instance as argument and returns
  a bool indicating if it should be cached.  May be None.
def google.appengine.ext.ndb.context.Context.get_memcache_timeout_policy (   self)
Return the current policy function for memcache timeout (expiration).
def google.appengine.ext.ndb.context.Context.in_transaction (   self)
Return whether a transaction is currently active.
def google.appengine.ext.ndb.context.Context.memcache_get (   self,
  key,
  for_cas = False,
  namespace = None,
  use_cache = False,
  deadline = None 
)
An auto-batching wrapper for memcache.get() or .get_multi().

Args:
  key: Key to set.  This must be a string; no prefix is applied.
  for_cas: If True, request and store CAS ids on the Context.
  namespace: Optional namespace.
  deadline: Optional deadline for the RPC.

Returns:
  A Future (!) whose return value is the value retrieved from
  memcache, or None.
def google.appengine.ext.ndb.context.Context.set_cache_policy (   self,
  func 
)
Set the context cache policy function.

Args:
  func: A function that accepts a Key instance as argument and returns
a bool indicating if it should be cached.  May be None.
def google.appengine.ext.ndb.context.Context.set_datastore_policy (   self,
  func 
)
Set the context datastore policy function.

Args:
  func: A function that accepts a Key instance as argument and returns
a bool indicating if it should use the datastore.  May be None.
def google.appengine.ext.ndb.context.Context.set_memcache_policy (   self,
  func 
)
Set the memcache policy function.

Args:
  func: A function that accepts a Key instance as argument and returns
a bool indicating if it should be cached.  May be None.
def google.appengine.ext.ndb.context.Context.set_memcache_timeout_policy (   self,
  func 
)
Set the policy function for memcache timeout (expiration).

Args:
  func: A function that accepts a key instance as argument and returns
an integer indicating the desired memcache timeout.  May be None.

If the function returns 0 it implies the default timeout.

The documentation for this class was generated from the following file: