A cache that stores all intermediates of an entry zlib-compressed on file system. Inspired from werkzeug.contrib.cache, but heavily modified to fit our needs.
Terminology: A cache object is a pickled dictionary into a single file. An intermediate (object) is a key/value pair that we store into a cache object. An intermediate is the content of an entry that is the same for a chain of filters used in different views.
cache is designed as global singleton and should not be constructed.
Location where all cache objects are being stored, defaults to .cache/.
The cache does no longer maintain used/unused intermediates and cache objects due performance reasons (and an edge case described in #67).
Wipe current cache objects and reset all stored informations.
|Parameters:||directory – directory to clean (defaults to .cache/|
Restore value from obj[key] if mtime has not changed or return default.
Get last modification timestamp from cache object but store it over the whole compilation process so we have the same value for different views.
Initialize cache object by creating the cache_dir if non-existent, read all available cache objects and restore memoized key/values.
Remove a cache object completely from disk and objects.
Save a key, value pair into a blob using pickle and moderate zlib compression (level 6). We simply save a dictionary containing all different intermediates (from every view) of an entry.
Write memoized key-value pairs to disk.
Use only for the environment container. This class hides un-hashable keys from Struct hash function.
Return whether the Environment has changed between two runs. This attribute must only be accessed after all modifications to the environment!