class Cache: (source)
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 |
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 |
Invalidate the cached content of the "body" method for this template. |
Method | invalidate |
Invalidate a nested ``<%def>`` within this template. |
Method | invalidate |
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 |
Retrieve a value from the cache, using the given creation function to generate a new value. |
Method | _get |
Undocumented |
Method | _load |
Undocumented |
Instance Variable | _def |
Undocumented |
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.
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.
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.
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.
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.