관리-도구
편집 파일: redis_cache.cpython-311.pyc
� �܋fj � �f � d dl mZ d dlmZmZ d dlmZ d dlmZ erd dlm Z G d� de� � Z dS ) � )�annotations)�datetime�timezone)� TYPE_CHECKING)� BaseCache)�Redisc �B � e Zd Zdd�Zdd �Z ddd�Zdd�Zdd�Zdd�Zd S )� RedisCache�conn�Redis[bytes]�return�Nonec � � || _ d S �N)r )�selfr s �b/opt/cloudlinux/venv/lib64/python3.11/site-packages/pip/_vendor/cachecontrol/caches/redis_cache.py�__init__zRedisCache.__init__ s � ��� � � � �key�str�bytes | Nonec �6 � | j � |� � S r )r �get�r r s r r zRedisCache.get s � ��y�}�}�S�!�!�!r N�value�bytes�expires�int | datetime | Nonec � � |s| j � ||� � d S t |t � � r}t j t j � � }|j �|� d �� � }||z }| j � |t |� � � � � |� � d S | j � |||� � d S )N)�tzinfo)r �set� isinstancer �nowr �utcr �replace�setex�int� total_seconds)r r r r �now_utc�deltas r r! zRedisCache.set s� � � � 1��I�M�M�#�u�%�%�%�%�%� ��� *� *� 1��l�8�<�0�0�G��~�%�!�/�/��/�6�6���g�%�E��I�O�O�C��U�%8�%8�%:�%:�!;�!;�U�C�C�C�C�C��I�O�O�C��%�0�0�0�0�0r c �: � | j � |� � d S r )r �deleter s r r, zRedisCache.delete% s � �� ��������r c �r � | j � � � D ]}| j � |� � �dS )zIHelper for clearing all the keys in a database. Use with caution!N)r �keysr, r s r �clearzRedisCache.clear( sB � � �9�>�>�#�#� "� "�C��I���S�!�!�!�!� "� "r c � � dS )z?Redis uses connection pooling, no need to close the connection.N� )r s r �closezRedisCache.close. s � ��r )r r r r )r r r r r )r r r r r r r r )r r r r )r r ) �__name__� __module__�__qualname__r r r! r, r/ r2 r1 r r r r s� � � � � � �� � � �"� "� "� "� HL�1� 1� 1� 1� 1�� � � �"� "� "� "� � � � � � r r N)� __future__r r r �typingr �pip._vendor.cachecontrol.cacher �redisr r r1 r r �<module>r: s� �� #� "� "� "� "� "� (� '� '� '� '� '� '� '� � � � � � � 4� 4� 4� 4� 4� 4�� ������� � � � � �� � � � � r