HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //home/arjun/projects/env/lib64/python3.10/site-packages/cachelib/__pycache__/uwsgi.cpython-310.pyc
o

!we
�@s<ddlZddlZddlmZddlmZGdd�de�ZdS)�N)�	BaseCache)�UWSGISerializerc
@s�eZdZdZe�Z		ddedefdd�Zded	e	j
fd
d�Zded	efdd
�Z
	ddede	j
de	jed	e	jefdd�Zddede	j
de	jed	efdd�Zd	efdd�Zded	efdd�ZdS)�
UWSGICachea^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
Cs`t�||�t��dkrtd��z	ddl}||_Wnty*}ztd�|�d}~ww||_dS)N�PyPyzFuWSGI caching does not work under PyPy, see the docs for more details.rz9uWSGI could not be imported, are you running under uWSGI?)	r�__init__�platform�python_implementation�RuntimeError�uwsgi�_uwsgi�ImportErrorr)�selfrrr�err�r�G/home/arjun/projects/env/lib/python3.10/site-packages/cachelib/uwsgi.pyr
s"�
����
zUWSGICache.__init__�key�returncCs(|j�||j�}|durdS|j�|�S�N)r�	cache_getr�
serializer�loads)rr�rvrrr�get1szUWSGICache.getcCst|j�||j��Sr)�boolr�	cache_delr�rrrrr�delete7�zUWSGICache.deleteN�value�timeoutcCs&|j�||j�|�|�|�|j�}|Sr)r�cache_updater�dumps�_normalize_timeoutr)rrr"r#�resultrrr�set:s
�zUWSGICache.setcCs&t|j�||j�|�|�|�|j��Sr)rr�	cache_setrr%r&r)rrr"r#rrr�addEs
��zUWSGICache.addcCst|j�|j��Sr)rr�cache_clearr)rrrr�clearOszUWSGICache.clearcCs|j�||j�duSr)r�cache_existsrrrrr�hasRr!zUWSGICache.has)rrr)�__name__�
__module__�__qualname__�__doc__rr�int�strr
�_t�Anyrrr �Optionalr(r*r,r.rrrrrs2��
�����
�$
r)r�typingr5�
cachelib.baser�cachelib.serializersrrrrrr�<module>s