Repository URL to install this package:
Version:
3.3.29 ▾
|
ó ëEYc @ sk d d l Z d d l m Z d e f d YZ e Z d e f d YZ d e f d YZ d S( iÿÿÿÿNi ( t py3kt NoValuec B s8 e Z d Z e d Z e r- d Z n d Z RS( sb Describe a missing cache value. The :attr:`.NO_VALUE` module global should be used. c C s | S( N( ( t self( ( sF /home/tvault/.virtenv/lib/python2.7/site-packages/dogpile/cache/api.pyt payload s c C s t S( N( t False( R ( ( sF /home/tvault/.virtenv/lib/python2.7/site-packages/dogpile/cache/api.pyt __bool__ s c C s t S( N( R ( R ( ( sF /home/tvault/.virtenv/lib/python2.7/site-packages/dogpile/cache/api.pyt __nonzero__ s ( t __name__t __module__t __doc__t propertyR R R R ( ( ( sF /home/tvault/.virtenv/lib/python2.7/site-packages/dogpile/cache/api.pyR s t CachedValuec B sJ e Z d Z e e j d Z e e j d Z d Z d Z RS( s9 Represent a value stored in the cache. :class:`.CachedValue` is a two-tuple of ``(payload, metadata)``, where ``metadata`` is dogpile.cache's tracking information ( currently the creation time). The metadata and tuple structure is pickleable, if the backend requires serialization. i i c C s t j | | | f S( N( t tuplet __new__( t clsR t metadata( ( sF /home/tvault/.virtenv/lib/python2.7/site-packages/dogpile/cache/api.pyR - s c C s t | j | j f f S( N( R R R ( R ( ( sF /home/tvault/.virtenv/lib/python2.7/site-packages/dogpile/cache/api.pyt __reduce__0 s ( R R R R t operatort itemgetterR R R R ( ( ( sF /home/tvault/.virtenv/lib/python2.7/site-packages/dogpile/cache/api.pyR s t CacheBackendc B st e Z d Z d Z d Z e d Z d Z d Z d Z d Z d Z d Z d Z d Z RS( s' Base class for backend implementations.c C s t d S( sã Construct a new :class:`.CacheBackend`. Subclasses should override this to handle the given arguments. :param arguments: The ``arguments`` parameter passed to :func:`.make_registry`. N( t NotImplementedError( R t arguments( ( sF /home/tvault/.virtenv/lib/python2.7/site-packages/dogpile/cache/api.pyt __init__? s c s2 t | t f d D S( Nc 3 s2 | ]( } | j r | | f Vq d S( N( t startswith( t .0t key( t config_dictt prefixt prefix_len( sF /home/tvault/.virtenv/lib/python2.7/site-packages/dogpile/cache/api.pys <genexpr>P s ( t lent dict( R R R ( ( R R R sF /home/tvault/.virtenv/lib/python2.7/site-packages/dogpile/cache/api.pyt from_config_dictK s c C s t S( N( R ( R ( ( sF /home/tvault/.virtenv/lib/python2.7/site-packages/dogpile/cache/api.pyt has_lock_timeoutV s c C s d S( s» Return an optional mutexing object for the given key. This object need only provide an ``acquire()`` and ``release()`` method. May return ``None``, in which case the dogpile lock will use a regular ``threading.Lock`` object to mutex concurrent threads for value creation. The default implementation returns ``None``. Different backends may want to provide various kinds of "mutex" objects, such as those which link to lock files, distributed mutexes, memcached semaphores, etc. Whatever kind of system is best suited for the scope and behavior of the caching backend. A mutex that takes the key into account will allow multiple regenerate operations across keys to proceed simultaneously, while a mutex that does not will serialize regenerate operations to just one at a time across all keys in the region. The latter approach, or a variant that involves a modulus of the given key's hash value, can be used as a means of throttling the total number of value recreation operations that may proceed at one time. N( t None( R R ( ( sF /home/tvault/.virtenv/lib/python2.7/site-packages/dogpile/cache/api.pyt get_mutexY s c C s t d S( s¦ Retrieve a value from the cache. The returned value should be an instance of :class:`.CachedValue`, or ``NO_VALUE`` if not present. N( R ( R R ( ( sF /home/tvault/.virtenv/lib/python2.7/site-packages/dogpile/cache/api.pyt getz s c C s t d S( s² Retrieve multiple values from the cache. The returned value should be a list, corresponding to the list of keys given. .. versionadded:: 0.5.0 N( R ( R t keys( ( sF /home/tvault/.virtenv/lib/python2.7/site-packages/dogpile/cache/api.pyt get_multi s c C s t d S( sò Set a value in the cache. The key will be whatever was passed to the registry, processed by the "key mangling" function, if any. The value will always be an instance of :class:`.CachedValue`. N( R ( R R t value( ( sF /home/tvault/.virtenv/lib/python2.7/site-packages/dogpile/cache/api.pyt set s c C s t d S( s& Set multiple values in the cache. ``mapping`` is a dict in which the key will be whatever was passed to the registry, processed by the "key mangling" function, if any. The value will always be an instance of :class:`.CachedValue`. When implementing a new :class:`.CacheBackend` or cutomizing via :class:`.ProxyBackend`, be aware that when this method is invoked by :meth:`.Region.get_or_create_multi`, the ``mapping`` values are the same ones returned to the upstream caller. If the subclass alters the values in any way, it must not do so 'in-place' on the ``mapping`` dict -- that will have the undesirable effect of modifying the returned values as well. .. versionadded:: 0.5.0 N( R ( R t mapping( ( sF /home/tvault/.virtenv/lib/python2.7/site-packages/dogpile/cache/api.pyt set_multi s c C s t d S( sH Delete a value from the cache. The key will be whatever was passed to the registry, processed by the "key mangling" function, if any. The behavior here should be idempotent, that is, can be called any number of times regardless of whether or not the key exists. N( R ( R R ( ( sF /home/tvault/.virtenv/lib/python2.7/site-packages/dogpile/cache/api.pyt delete² s c C s t d S( sr Delete multiple values from the cache. The key will be whatever was passed to the registry, processed by the "key mangling" function, if any. The behavior here should be idempotent, that is, can be called any number of times regardless of whether or not the key exists. .. versionadded:: 0.5.0 N( R ( R R$ ( ( sF /home/tvault/.virtenv/lib/python2.7/site-packages/dogpile/cache/api.pyt delete_multiÀ s N( R R R R! t key_manglerR t classmethodR R R" R# R% R' R) R* R+ ( ( ( sF /home/tvault/.virtenv/lib/python2.7/site-packages/dogpile/cache/api.pyR 4 s ! ( R t util.compatR t objectR t NO_VALUER R R ( ( ( sF /home/tvault/.virtenv/lib/python2.7/site-packages/dogpile/cache/api.pyt <module> s