class documentation

class FileSystemBytecodeCache(BytecodeCache):

View In Hierarchy

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 a default cache directory is selected. On Windows the user's temp directory is used, on UNIX systems a directory is created for the user in the system temp directory.

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.

Method __init__ Undocumented
Method ​_get​_cache​_filename Undocumented
Method ​_get​_default​_cache​_dir Undocumented
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 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 directory Undocumented
Instance Variable pattern Undocumented

Inherited from BytecodeCache:

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, directory=None, pattern='__jinja2_%s.cache'):

Undocumented

Parameters
directory:t.Optional[str]Undocumented
pattern:strUndocumented
def _get_cache_filename(self, bucket):

Undocumented

Parameters
bucket:BucketUndocumented
Returns
strUndocumented
def _get_default_cache_dir(self):

Undocumented

Returns
strUndocumented
def clear(self):
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.
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
directory =

Undocumented

pattern =

Undocumented