Qucs-S S-parameter Viewer & RF Synthesis Tools
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
jinja2.bccache.MemcachedBytecodeCache Class Reference
Inheritance diagram for jinja2.bccache.MemcachedBytecodeCache:
Inheritance graph
[legend]
Collaboration diagram for jinja2.bccache.MemcachedBytecodeCache:
Collaboration graph
[legend]

Public Member Functions

 __init__ (self, "_MemcachedClient" client, str prefix="jinja2/bytecode/", t.Optional[int] timeout=None, bool ignore_memcache_errors=True)
 
None load_bytecode (self, Bucket bucket)
 
None dump_bytecode (self, Bucket bucket)
 
- Public Member Functions inherited from jinja2.bccache.BytecodeCache
None clear (self)
 
str get_cache_key (self, str name, t.Optional[t.Union[str]] filename=None)
 
str get_source_checksum (self, str source)
 
Bucket get_bucket (self, "Environment" environment, str name, t.Optional[str] filename, str source)
 
None set_bucket (self, Bucket bucket)
 

Public Attributes

 client
 
 prefix
 
 timeout
 
 ignore_memcache_errors
 

Detailed Description

This class implements a bytecode cache that uses a memcache cache for
storing the information.  It does not enforce a specific memcache library
(tummy's memcache or cmemcache) but will accept any class that provides
the minimal interface required.

Libraries compatible with this class:

-   `cachelib <https://github.com/pallets/cachelib>`_
-   `python-memcached <https://pypi.org/project/python-memcached/>`_

(Unfortunately the django cache interface is not compatible because it
does not support storing binary data, only text. You can however pass
the underlying cache client to the bytecode cache which is available
as `django.core.cache.cache._client`.)

The minimal interface for the client passed to the constructor is this:

.. class:: MinimalClientInterface

    .. method:: set(key, value[, timeout])

        Stores the bytecode in the cache.  `value` is a string and
        `timeout` the timeout of the key.  If timeout is not provided
        a default timeout or no timeout should be assumed, if it's
        provided it's an integer with the number of seconds the cache
        item should exist.

    .. method:: get(key)

        Returns the value for the cache key.  If the item does not
        exist in the cache the return value must be `None`.

The other arguments to the constructor are the prefix for all keys that
is added before the actual cache key and the timeout for the bytecode in
the cache system.  We recommend a high (or no) timeout.

This bytecode cache does not support clearing of used items in the cache.
The clear method is a no-operation function.

.. versionadded:: 2.7
   Added support for ignoring memcache errors through the
   `ignore_memcache_errors` parameter.

Member Function Documentation

◆ dump_bytecode()

None jinja2.bccache.MemcachedBytecodeCache.dump_bytecode (   self,
Bucket  bucket 
)
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.

Reimplemented from jinja2.bccache.BytecodeCache.

◆ load_bytecode()

None jinja2.bccache.MemcachedBytecodeCache.load_bytecode (   self,
Bucket  bucket 
)
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.

Reimplemented from jinja2.bccache.BytecodeCache.


The documentation for this class was generated from the following file: