class documentation

class MemcachedBytecodeCache(BytecodeCache):

View In Hierarchy

This class implements a bytecode cache that uses a memcache cache for storing the information. It does not enforce a specific memcache library (tummy's memcache or cmemcache) but will accept any class that provides the minimal interface required.

Libraries compatible with this class:

(Unfortunately the django cache interface is not compatible because it does not support storing binary data, only text. You can however pass the underlying cache client to the bytecode cache which is available as django.core.cache.cache._client.)

The minimal interface for the client passed to the constructor is this:

The other arguments to the constructor are the prefix for all keys that is added before the actual cache key and the timeout for the bytecode in the cache system. We recommend a high (or no) timeout.

This bytecode cache does not support clearing of used items in the cache. The clear method is a no-operation function.

New in version 2.7: Added support for ignoring memcache errors through the ignore_memcache_errors parameter.
Method __init__ Undocumented
Method dump​_bytecode Subclasses have to override this method to write the bytecode from a bucket back to the cache. If it unable to do so it must not fail silently but raise an exception.
Method load​_bytecode Subclasses have to override this method to load bytecode into a bucket. If they are not able to find code in the cache for the bucket, it must not do anything.
Instance Variable client Undocumented
Instance Variable ignore​_memcache​_errors Undocumented
Instance Variable prefix Undocumented
Instance Variable timeout Undocumented

Inherited from BytecodeCache:

Method clear Clears the cache. This method is not used by Jinja but should be implemented to allow applications to clear the bytecode cache used by a particular environment.
Method get​_bucket Return a cache bucket for the given template. All arguments are mandatory but filename may be None.
Method get​_cache​_key Returns the unique hash key for this template name.
Method get​_source​_checksum Returns a checksum for the source.
Method set​_bucket Put the bucket into the cache.
def __init__(self, client, prefix='jinja2/bytecode/', timeout=None, ignore_memcache_errors=True):

Undocumented

Parameters
client:_MemcachedClientUndocumented
prefix:strUndocumented
timeout:t.Optional[int]Undocumented
ignore​_memcache​_errors:boolUndocumented
def dump_bytecode(self, bucket):
Subclasses have to override this method to write the bytecode from a bucket back to the cache. If it unable to do so it must not fail silently but raise an exception.
Parameters
bucket:BucketUndocumented
def load_bytecode(self, bucket):
Subclasses have to override this method to load bytecode into a bucket. If they are not able to find code in the cache for the bucket, it must not do anything.
Parameters
bucket:BucketUndocumented
client =

Undocumented

ignore_memcache_errors =

Undocumented

prefix =

Undocumented

timeout =

Undocumented