• Home
  • Raw
  • Download

Lines Matching +full:cache +full:- +full:from

1 """The optional bytecode cache system. This is useful if you have very
16 from hashlib import sha1
17 from io import BytesIO
19 from .utils import open_if_exists
22 # Magic bytes to identify Jinja bytecode cache files. Contains the
34 and initialized by the bytecode cache and passed to the loading functions.
36 The buckets get an internal checksum from the cache assigned and use this
37 to automatically reject outdated cache material. Individual bytecode
38 cache subclasses don't have to care about cache invalidation.
52 """Loads bytecode from a file or file like object."""
79 """Load bytecode from a string."""
90 """To implement your own bytecode cache you have to subclass this class
94 A very basic bytecode cache that saves the bytecode on the file system::
96 from os import path
114 A more advanced version of a filesystem based bytecode cache is part of
120 bucket. If they are not able to find code in the cache for the
127 from a bucket back to the cache. If it unable to do so it must not
133 """Clears the cache. This method is not used by Jinja but should be
134 implemented to allow applications to clear the bytecode cache used
140 hash = sha1(name.encode("utf-8"))
144 filename = filename.encode("utf-8")
150 return sha1(source.encode("utf-8")).hexdigest()
153 """Return a cache bucket for the given template. All arguments are
163 """Put the bucket into the cache."""
168 """A bytecode cache that stores bytecode on the filesystem. It accepts
169 two arguments: The directory where the cache items are stored and a
172 If no directory is specified a default cache directory is selected. On
177 same directory. The default pattern is ``'__jinja2_%s.cache'``. ``%s``
178 is replaced with the cache key.
180 >>> bcc = FileSystemBytecodeCache('/tmp/jinja_cache', '%s.cache')
182 This bytecode cache supports clearing of the cache using the clear method.
185 def __init__(self, directory=None, pattern="__jinja2_%s.cache"):
207 dirname = f"_jinja2-cache-{os.getuid()}"
257 # imported lazily here because google app-engine doesn't support
260 from os import remove
271 """This class implements a bytecode cache that uses a memcache cache for
278 - `cachelib <https://github.com/pallets/cachelib>`_
279 - `python-memcached <https://pypi.org/project/python-memcached/>`_
281 (Unfortunately the django cache interface is not compatible because it
283 the underlying cache client to the bytecode cache which is available
284 as `django.core.cache.cache._client`.)
292 Stores the bytecode in the cache. `value` is a string and
295 provided it's an integer with the number of seconds the cache
300 Returns the value for the cache key. If the item does not
301 exist in the cache the return value must be `None`.
304 is added before the actual cache key and the timeout for the bytecode in
305 the cache system. We recommend a high (or no) timeout.
307 This bytecode cache does not support clearing of used items in the cache.
308 The clear method is a no-operation function.