
    h
                     B    S SK r S SKrS SKJr  S SKJr   " S S\5      rg)    N)	BaseCache)UWSGISerializerc            
       L   \ rS rSrSr\" 5       r  SS\S\4S jjr	S\S\
R                  4S jrS\S\4S	 jr SS\S\
R                  S\
R                  \   S\
R                  \   4S jjrSS\S\
R                  S\
R                  \   S\4S jjrS\4S jrS\S\4S jrSrg
)
UWSGICache   a6  Implements the cache using uWSGI's caching framework.

.. note::
    This class cannot be used when running under PyPy, because the uWSGI
    API implementation for PyPy is lacking the needed functionality.

:param default_timeout: The default timeout in seconds.
:param cache: The name of the caching instance to connect to, for
    example: mycache@localhost:3031, defaults to an empty string, which
    means uWSGI will cache in the local instance. If the cache is in the
    same instance as the werkzeug app, you only have to provide the name of
    the cache.
default_timeoutcachec                     [         R                  " X5        [        R                  " 5       S:X  a  [	        S5      e SS KnX0l        X l        g ! [         a  n[	        S5      UeS nAff = f)NPyPyzFuWSGI caching does not work under PyPy, see the docs for more details.r   z9uWSGI could not be imported, are you running under uWSGI?)	r   __init__platformpython_implementationRuntimeErroruwsgi_uwsgiImportErrorr	   )selfr   r	   r   errs        cC:\Users\ROHAN GUPTA\OneDrive\Desktop\mathbuddy-assessment\venv\Lib\site-packages\cachelib/uwsgi.pyr   UWSGICache.__init__   sn    
 	41))+v5- 
	K 
  	K	s   
A 
A(A##A(keyreturnc                     U R                   R                  XR                  5      nUc  g U R                  R	                  U5      $ N)r   	cache_getr	   
serializerloads)r   r   rvs      r   getUWSGICache.get1   s7    [[""3

3:$$R((    c                 ^    [        U R                  R                  XR                  5      5      $ r   )boolr   	cache_delr	   r   r   s     r   deleteUWSGICache.delete7   s     DKK))#zz:;;r!   Nvaluetimeoutc                     U R                   R                  UU R                  R                  U5      U R	                  U5      U R
                  5      nU$ r   )r   cache_updater   dumps_normalize_timeoutr	   )r   r   r(   r)   results        r   setUWSGICache.set:   sI     ))OO!!%(##G,JJ	
 r!   c           	          [        U R                  R                  UU R                  R	                  U5      U R                  U5      U R                  5      5      $ r   )r#   r   	cache_setr   r,   r-   r	   )r   r   r(   r)   s       r   addUWSGICache.addE   sK    KK!!%%e,''0

	
 	
r!   c                 ^    [        U R                  R                  U R                  5      5      $ r   )r#   r   cache_clearr	   )r   s    r   clearUWSGICache.clearO   s     DKK++DJJ788r!   c                 P    U R                   R                  XR                  5      S L$ r   )r   cache_existsr	   r%   s     r   hasUWSGICache.hasR   s     {{''ZZ8DDr!   )r   r	   )i,   r   )__name__
__module____qualname____firstlineno____doc__r   r   intstrr   _tAnyr   r#   r&   Optionalr/   r3   r7   r;   __static_attributes__ r!   r   r   r      s     !"J  # 0)s )rvv )<# <$ < DH		!vv	02C0@		T		
s 
266 
BKK4D 
PT 
9t 9Es Et Er!   r   )r   typingrE   cachelib.baser   cachelib.serializersr   r   rI   r!   r   <module>rM      s!      # 0KE KEr!   