• Home
  • Raw
  • Download

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

1 # -*- coding: utf-8 -*-
6 This module implements the bytecode cache system Jinja is optionally
17 from os import path, listdir
25 from hashlib import sha1
26 from jinja2.utils import open_if_exists
27 from jinja2._compat import BytesIO, pickle, PY2, text_type
62 and initialized by the bytecode cache and passed to the loading functions.
64 The buckets get an internal checksum from the cache assigned and use this
65 to automatically reject outdated cache material. Individual bytecode
66 cache subclasses don't have to care about cache invalidation.
80 """Loads bytecode from a file or file like object."""
107 """Load bytecode from a string."""
118 """To implement your own bytecode cache you have to subclass this class
122 A very basic bytecode cache that saves the bytecode on the file system::
124 from os import path
142 A more advanced version of a filesystem based bytecode cache is part of
148 bucket. If they are not able to find code in the cache for the
155 from a bucket back to the cache. If it unable to do so it must not
161 """Clears the cache. This method is not used by Jinja2 but should be
162 implemented to allow applications to clear the bytecode cache used
168 hash = sha1(name.encode('utf-8'))
172 filename = filename.encode('utf-8')
178 return sha1(source.encode('utf-8')).hexdigest()
181 """Return a cache bucket for the given template. All arguments are
191 """Put the bucket into the cache."""
196 """A bytecode cache that stores bytecode on the filesystem. It accepts
197 two arguments: The directory where the cache items are stored and a
200 If no directory is specified a default cache directory is selected. On
205 same directory. The default pattern is ``'__jinja2_%s.cache'``. ``%s``
206 is replaced with the cache key.
208 >>> bcc = FileSystemBytecodeCache('/tmp/jinja_cache', '%s.cache')
210 This bytecode cache supports clearing of the cache using the clear method.
213 def __init__(self, directory=None, pattern='__jinja2_%s.cache'):
233 dirname = '_jinja2-cache-%d' % os.getuid()
279 # imported lazily here because google app-engine doesn't support
282 from os import remove
292 """This class implements a bytecode cache that uses a memcache cache for
299 - `werkzeug <http://werkzeug.pocoo.org/>`_.contrib.cache
300 - `python-memcached <https://www.tummy.com/Community/software/python-memcached/>`_
301 - `cmemcache <http://gijsbert.org/cmemcache/>`_
303 (Unfortunately the django cache interface is not compatible because it
305 the underlying cache client to the bytecode cache which is available
306 as `django.core.cache.cache._client`.)
314 Stores the bytecode in the cache. `value` is a string and
317 provided it's an integer with the number of seconds the cache
322 Returns the value for the cache key. If the item does not
323 exist in the cache the return value must be `None`.
326 is added before the actual cache key and the timeout for the bytecode in
327 the cache system. We recommend a high (or no) timeout.
329 This bytecode cache does not support clearing of used items in the cache.
330 The clear method is a no-operation function.