class documentation

class FileSystemBytecodeCache(BytecodeCache): (source)

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 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
Method _get_cache_filename Undocumented
Method _get_default_cache_dir 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'): (source)

Undocumented

Parameters
directory:t.Optional[str]Undocumented
pattern:strUndocumented
def clear(self): (source)

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): (source)

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): (source)

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 = (source)

Undocumented

pattern = (source)

Undocumented

def _get_cache_filename(self, bucket): (source)

Undocumented

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

Undocumented

Returns
strUndocumented