B
    =)H[y  ã               @   s@   d dl mZ d dlmZ d dlmZ dd„ ZG dd„ deƒZdS )	é    )Údivision)Údatetime)Ú	BaseCachec             C   sD   t | dƒrt|  ¡ ƒS | j}| j| jd d  }t||d  d ƒS )zPython 2.6 compatabilityÚtotal_secondsé   i  i@B )ÚhasattrÚintr   ÚmicrosecondsÚsecondsÚdays)ÚtdÚmsÚsecs© r   úlC:\Users\HIRONO~1\AppData\Local\Temp\pip-install-qz7kpjmn\pip\pip\_vendor\cachecontrol\caches\redis_cache.pyr      s
    
r   c               @   s>   e Zd Zdd„ Zdd„ Zddd„Zdd	„ Zd
d„ Zdd„ ZdS )Ú
RedisCachec             C   s
   || _ d S )N)Úconn)Úselfr   r   r   r   Ú__init__   s    zRedisCache.__init__c             C   s   | j  |¡S )N)r   Úget)r   Úkeyr   r   r   r      s    zRedisCache.getNc             C   s8   |s| j  ||¡ n |t ¡  }| j  |t|ƒ|¡ d S )N)r   Úsetr   ÚutcnowÚsetexr   )r   r   ÚvalueÚexpiresr   r   r   r      s    zRedisCache.setc             C   s   | j  |¡ d S )N)r   Údelete)r   r   r   r   r   r       s    zRedisCache.deletec             C   s$   x| j  ¡ D ]}| j  |¡ qW dS )zIHelper for clearing all the keys in a database. Use with
        caution!N)r   Úkeysr   )r   r   r   r   r   Úclear#   s    zRedisCache.clearc             C   s   dS )z?Redis uses connection pooling, no need to close the connection.Nr   )r   r   r   r   Úclose)   s    zRedisCache.close)N)	Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r   r   r   r   r   r   r      s   
r   N)Ú
__future__r   r   Zpip._vendor.cachecontrol.cacher   r   r   r   r   r   r   Ú<module>   s   
