class documentation

Represents a data content cache made available to the module space of a specific :class:`.Template` object. .. versionadded:: 0.6 :class:`.Cache` by itself is mostly a container for a :class:`.CacheImpl` object, which implements a fixed API to provide caching services; specific subclasses exist to implement different caching strategies. Mako includes a backend that works with the Beaker caching system. Beaker itself then supports a number of backends (i.e. file, memory, memcached, etc.) The construction of a :class:`.Cache` is part of the mechanics of a :class:`.Template`, and programmatic access to this cache is typically via the :attr:`.Template.cache` attribute.

Method __init__ Undocumented
Method get Retrieve a value from the cache.
Method get_or_create Retrieve a value from the cache, using the given creation function to generate a new value.
Method invalidate Invalidate a value in the cache.
Method invalidate_body Invalidate the cached content of the "body" method for this template.
Method invalidate_closure Invalidate a nested ``<%def>`` within this template.
Method invalidate_def Invalidate the cached content of a particular ``<%def>`` within this template.
Method set Place a value in the cache.
Instance Variable id Return the 'id' that identifies this cache.
Instance Variable impl Provide the :class:`.CacheImpl` in use by this :class:`.Cache`.
Instance Variable starttime Epochal time value for when the owning :class:`.Template` was first compiled.
Instance Variable template Undocumented
Method _ctx_get_or_create Retrieve a value from the cache, using the given creation function to generate a new value.
Method _get_cache_kw Undocumented
Method _load_impl Undocumented
Instance Variable _def_regions Undocumented
def __init__(self, template, *args): (source)

Undocumented

def get(self, key, **kw): (source)

Retrieve a value from the cache. :param key: the value's key. :param \**kw: cache configuration arguments. The backend is configured using these arguments upon first request. Subsequent requests that use the same series of configuration values will use that same backend.

def get_or_create(self, key, creation_function, **kw): (source)

Retrieve a value from the cache, using the given creation function to generate a new value.

def invalidate(self, key, **kw): (source)

Invalidate a value in the cache. :param key: the value's key. :param \**kw: cache configuration arguments. The backend is configured using these arguments upon first request. Subsequent requests that use the same series of configuration values will use that same backend.

def invalidate_body(self): (source)

Invalidate the cached content of the "body" method for this template.

def invalidate_closure(self, name): (source)

Invalidate a nested ``<%def>`` within this template. Caching of nested defs is a blunt tool as there is no management of scope -- nested defs that use cache tags need to have names unique of all other nested defs in the template, else their content will be overwritten by each other.

def invalidate_def(self, name): (source)

Invalidate the cached content of a particular ``<%def>`` within this template.

def set(self, key, value, **kw): (source)

Place a value in the cache. :param key: the value's key. :param value: the value. :param \**kw: cache configuration arguments.

Return the 'id' that identifies this cache. This is a value that should be globally unique to the :class:`.Template` associated with this cache, and can be used by a caching system to name a local container for data specific to this template.

Provide the :class:`.CacheImpl` in use by this :class:`.Cache`. This accessor allows a :class:`.CacheImpl` with additional methods beyond that of :class:`.Cache` to be used programmatically.

starttime = (source)

Epochal time value for when the owning :class:`.Template` was first compiled. A cache implementation may wish to invalidate data earlier than this timestamp; this has the effect of the cache for a specific :class:`.Template` starting clean any time the :class:`.Template` is recompiled, such as when the original template file changed on the filesystem.

template = (source)

Undocumented

def _ctx_get_or_create(self, key, creation_function, context, **kw): (source)

Retrieve a value from the cache, using the given creation function to generate a new value.

def _get_cache_kw(self, kw, context): (source)

Undocumented

def _load_impl(self, name): (source)

Undocumented

_def_regions: dict = (source)

Undocumented