o
    ÖèFh   ã                   @  sr   d Z ddlmZ ddlmZ ddlmZmZmZ er ddl	m	Z	 G dd„ dƒZ
G dd	„ d	e
ƒZG d
d„ de
ƒZdS )zb
The cache object API for implementing caches. The default is a thread
safe in-memory dictionary.
é    )Úannotations)ÚLock)ÚIOÚTYPE_CHECKINGÚMutableMapping)Údatetimec                   @  s8   e Zd Zddd„Z	dddd„Zddd„Zddd„ZdS )Ú	BaseCacheÚkeyÚstrÚreturnúbytes | Nonec                 C  ó   t ƒ ‚©N©ÚNotImplementedError©Úselfr	   © r   úK/var/www/html/loop/nvenv/lib/python3.10/site-packages/cachecontrol/cache.pyÚget   ó   zBaseCache.getNÚvalueÚbytesÚexpiresúint | datetime | NoneÚNonec                 C  r   r   r   ©r   r	   r   r   r   r   r   Úset   s   zBaseCache.setc                 C  r   r   r   r   r   r   r   Údelete   r   zBaseCache.deletec                 C  s   d S r   r   )r   r   r   r   Úclose   s   zBaseCache.close©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   r   r   r   r      s    
ÿ
r   c                   @  s:   e Zd Zdddd„Zddd„Z	dddd„Zddd„ZdS )Ú	DictCacheNÚ	init_dictú!MutableMapping[str, bytes] | Noner   r   c                 C  s   t ƒ | _|pi | _d S r   )r   ÚlockÚdata)r   r'   r   r   r   Ú__init__#   s   zDictCache.__init__r	   r
   r   c                 C  s   | j  |d ¡S r   )r*   r   r   r   r   r   r   '   s   zDictCache.getr   r   r   r   c                 C  s<   | j � | j ||i¡ W d   ƒ d S 1 sw   Y  d S r   )r)   r*   Úupdater   r   r   r   r   *   s   "ÿzDictCache.setc                 C  sR   | j � || jv r| j |¡ W d   ƒ d S W d   ƒ d S 1 s"w   Y  d S r   )r)   r*   Úpopr   r   r   r   r   0   s   
þ"ÿzDictCache.deleter   )r'   r(   r   r   r    r!   r"   )r#   r$   r%   r+   r   r   r   r   r   r   r   r&   "   s    
ÿr&   c                   @  s$   e Zd ZdZddd	„Zddd„ZdS )ÚSeparateBodyBaseCacheag  
    In this variant, the body is not stored mixed in with the metadata, but is
    passed in (as a bytes-like object) in a separate call to ``set_body()``.

    That is, the expected interaction pattern is::

        cache.set(key, serialized_metadata)
        cache.set_body(key)

    Similarly, the body should be loaded separately via ``get_body()``.
    r	   r
   Úbodyr   r   r   c                 C  r   r   r   )r   r	   r/   r   r   r   Úset_bodyC   r   zSeparateBodyBaseCache.set_bodyúIO[bytes] | Nonec                 C  r   )z6
        Return the body as file-like object.
        r   r   r   r   r   Úget_bodyF   s   zSeparateBodyBaseCache.get_bodyN)r	   r
   r/   r   r   r   )r	   r
   r   r1   )r#   r$   r%   Ú__doc__r0   r2   r   r   r   r   r.   6   s    
r.   N)r3   Ú
__future__r   Ú	threadingr   Útypingr   r   r   r   r   r&   r.   r   r   r   r   Ú<module>   s   