class FileSystemBytecodeCache(BytecodeCache):
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. |
Undocumented
Parameters | |
directory:t.Optional[ | Undocumented |
pattern:str | Undocumented |
Undocumented
Parameters | |
bucket:Bucket | Undocumented |
Returns | |
str | Undocumented |
jinja2.bccache.BytecodeCache.clear
Parameters | |
bucket:Bucket | Undocumented |
Parameters | |
bucket:Bucket | Undocumented |