class FileSystemBytecodeCache(BytecodeCache): (source)
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 |
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 |
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 |
Undocumented |
Method | _get |
Undocumented |
Inherited from BytecodeCache
:
Method | get |
Return a cache bucket for the given template. All arguments are mandatory but filename may be `None`. |
Method | get |
Returns the unique hash key for this template name. |
Method | get |
Returns a checksum for the source. |
Method | set |
Put the bucket into the cache. |
jinja2.bccache.BytecodeCache.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.
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:Bucket | Undocumented |
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:Bucket | Undocumented |