FileSystemBytecodeCache Class

Inheritance diagram of FileSystemBytecodeCache

class FileSystemBytecodeCache(directory=None, pattern='__jinja2_%s.cache')

A bytecode cache that stores bytecode on the filesystem. It accepts two arguments: The directory where the cache items are stored and a pattern string that is used to build the filename.

If no directory is specified the system temporary items folder is used.

The pattern can be used to have multiple separate caches operate on the same directory. The default pattern is '__jinja2_%s.cache'. %s is replaced with the cache key.

>>> bcc = FileSystemBytecodeCache('/tmp/jinja_cache', '%s.cache')

This bytecode cache supports clearing of the cache using the clear method.

Methods

__init__([directory, pattern])
clear()
dump_bytecode(bucket)
get_bucket(environment, name, filename, source) Return a cache bucket for the given template.
get_cache_key(name[, filename]) Returns the unique hash key for this template name.
get_source_checksum(source) Returns a checksum for the source.
load_bytecode(bucket)
set_bucket(bucket) Put the bucket into the cache.

Descriptions

class FileSystemBytecodeCache

Method details

__init__(directory=None, pattern='__jinja2_%s.cache')
clear()
dump_bytecode(bucket)
load_bytecode(bucket)

Inherited member details

get_bucket(environment, name, filename, source)

Return a cache bucket for the given template. All arguments are mandatory but filename may be None.

get_cache_key(name, filename=None)

Returns the unique hash key for this template name.

get_source_checksum(source)

Returns a checksum for the source.

set_bucket(bucket)

Put the bucket into the cache.

Table Of Contents

Previous topic

BytecodeCache Class

Next topic

MemcachedBytecodeCache Class