|
Server : Apache System : Linux cvar2.toservers.com 3.10.0-962.3.2.lve1.5.73.el7.x86_64 #1 SMP Wed Aug 24 21:31:23 UTC 2022 x86_64 User : njnconst ( 1116) PHP Version : 8.4.18 Disable Function : NONE Directory : /usr/lib64/python2.7/site-packages/django/core/cache/backends/ |
Upload File : |
�
r�\c @ s� d Z d d l m Z d d l Z d d l m Z m Z d d l m Z d e f d � � YZ d e f d � � YZ
e � Z d
Z
d � Z d � Z d
e f d � � YZ d S( u Base Cache class.i����( t unicode_literalsN( t ImproperlyConfiguredt DjangoRuntimeWarning( t import_by_patht InvalidCacheBackendErrorc B s e Z RS( ( t __name__t
__module__( ( ( sA /tmp/pip-install-XxeQeY/django/django/core/cache/backends/base.pyR
s t CacheKeyWarningc B s e Z RS( ( R R ( ( ( sA /tmp/pip-install-XxeQeY/django/django/core/cache/backends/base.pyR s i� c C s d | | | f S( u�
Default function to generate keys.
Constructs the key used by all other methods. By default it prepends
the `key_prefix'. KEY_FUNCTION can be used to specify an alternate
function with custom key making behavior.
u %s:%s:%s( ( t keyt
key_prefixt version( ( sA /tmp/pip-install-XxeQeY/django/django/core/cache/backends/base.pyt default_key_func s c C s- | d k r) t | � r | St | � Sn t S( u^
Function to decide which key function to use.
Defaults to ``default_key_func``.
N( t Nonet callableR R ( t key_func( ( sA /tmp/pip-install-XxeQeY/django/django/core/cache/backends/base.pyt get_key_func% s
t BaseCachec B s� e Z d � Z d d � Z e d d � Z d d d � Z e d d � Z d d � Z d d � Z
d d � Z d d d � Z d d d
� Z
d � Z e d d � Z d d
� Z d � Z d � Z d d d � Z d d d � Z d � Z RS( c C sZ | j d | j d d � � } y t | � } Wn t t f k
rM d } n X| | _ | j d i � } | j d | j d d � � } y t | � | _ Wn t t f k
r� d | _ n X| j d | j d d � � } y t | � | _ Wn t t f k
rd | _ n X| j d
d � | _ | j d d
� | _ t | j d d � � | _ d S( Nu timeoutu TIMEOUTi, u OPTIONSu max_entriesu MAX_ENTRIESu cull_frequencyu CULL_FREQUENCYi u
KEY_PREFIXu u VERSIONi u KEY_FUNCTION( t gett intt
ValueErrort TypeErrort default_timeoutt _max_entriest _cull_frequencyR R
R R R ( t selft paramst timeoutt optionst max_entriest cull_frequency( ( sA /tmp/pip-install-XxeQeY/django/django/core/cache/backends/base.pyt __init__4 s(
c C s4 | d k r | j } n | j | | j | � } | S( ut Constructs the key used by all other methods. By default it
uses the key_func to generate a key (which, by default,
prepends the `key_prefix' and 'version'). An different key
function can be provided at the time of cache construction;
alternatively, you can subclass the cache backend to provide
custom key making behavior.
N( R R
R R ( R R R
t new_key( ( sA /tmp/pip-install-XxeQeY/django/django/core/cache/backends/base.pyt make_keyM s c C s
t � d S( u
Set a value in the cache if the key does not already exist. If
timeout is given, that timeout will be used for the key; otherwise
the default cache timeout will be used.
Returns True if the value was stored, False otherwise.
N( t NotImplementedError( R R t valueR R
( ( sA /tmp/pip-install-XxeQeY/django/django/core/cache/backends/base.pyt add[ s c C s
t � d S( u�
Fetch a given key from the cache. If the key does not exist, return
default, which itself defaults to None.
N( R! ( R R t defaultR
( ( sA /tmp/pip-install-XxeQeY/django/django/core/cache/backends/base.pyR e s c C s
t � d S( u�
Set a value in the cache. If timeout is given, that timeout will be
used for the key; otherwise the default cache timeout will be used.
N( R! ( R R R"