§
    X˜¶fK  ã                   óD   — d dl Z G d„ d¦  «        Z G d„ de¦  «        ZdS )é    Nc            
       óv  — e Zd ZdZddefd„Zdej        e         defd„Zde	dej
        fd	„Zde	defd
„Zde	dej        ej
                 fd„Zde	dej        e	ej
        f         fd„Z	 dde	dej
        dej        e         dej        e         fd„Zdde	dej
        dej        e         defd„Z	 ddej        e	ej
        f         dej        e         dej        ej
                 fd„Zde	dej        ej
                 fd„Zde	defd„Zdefd„Zdde	dedej        e         fd„Zdde	dedej        e         fd„ZdS )Ú	BaseCacheaM  Baseclass for the cache systems.  All the cache systems implement this
    API or a superset of it.

    :param default_timeout: the default timeout (in seconds) that is used if
                            no timeout is specified on :meth:`set`. A timeout
                            of 0 indicates that the cache never expires.
    é,  Údefault_timeoutc                 ó   — || _         d S ©N©r   )Úselfr   s     úA/var/www/piapp/venv/lib/python3.11/site-packages/cachelib/base.pyÚ__init__zBaseCache.__init__   s   € Ø.ˆÔÐÐó    ÚtimeoutÚreturnc                 ó   — |€| j         }|S r   r	   )r
   r   s     r   Ú_normalize_timeoutzBaseCache._normalize_timeout   s   € Øˆ?ØÔ*ˆGØˆr   Úkeyc                 ó   — dS )zµLook up key in the cache and return the value for it.

        :param key: the key to be looked up.
        :returns: The value if it exists and is readable, else ``None``.
        N© ©r
   r   s     r   ÚgetzBaseCache.get   s	   € ð ˆtr   c                 ó   — dS )z¥Delete `key` from the cache.

        :param key: the key to delete.
        :returns: Whether the key existed and has been deleted.
        :rtype: boolean
        Tr   r   s     r   ÚdeletezBaseCache.delete   ó	   € ð ˆtr   Úkeysc                 ó    ‡ — ˆ fd„|D ¦   «         S )a<  Returns a list of values for the given keys.
        For each key an item in the list is created::

            foo, bar = cache.get_many("foo", "bar")

        Has the same error handling as :meth:`get`.

        :param keys: The function accepts multiple keys as positional
                     arguments.
        c                 ó:   •— g | ]}‰                      |¦  «        ‘ŒS r   )r   )Ú.0Úkr
   s     €r   ú
<listcomp>z&BaseCache.get_many.<locals>.<listcomp>1   s#   ø€ Ð*Ð*Ð* �—’˜‘”Ð*Ð*Ð*r   r   ©r
   r   s   ` r   Úget_manyzBaseCache.get_many&   s   ø€ ð +Ð*Ð*Ð* TÐ*Ñ*Ô*Ð*r   c                 óL   — t          t          | | j        |Ž ¦  «        ¦  «        S )zýLike :meth:`get_many` but return a dict::

            d = cache.get_dict("foo", "bar")
            foo = d["foo"]
            bar = d["bar"]

        :param keys: The function accepts multiple keys as positional
                     arguments.
        )ÚdictÚzipr!   r    s     r   Úget_dictzBaseCache.get_dict3   s%   € õ •C˜˜m˜dœm¨TÐ2Ñ3Ô3Ñ4Ô4Ð4r   NÚvaluec                 ó   — dS )ak  Add a new key/value to the cache (overwrites value, if key already
        exists in the cache).

        :param key: the key to set
        :param value: the value for the key
        :param timeout: the cache timeout for the key in seconds (if not
                        specified, it uses the default timeout). A timeout of
                        0 indicates that the cache never expires.
        :returns: ``True`` if key has been updated, ``False`` for backend
                  errors. Pickling errors, however, will raise a subclass of
                  ``pickle.PickleError``.
        :rtype: boolean
        Tr   ©r
   r   r&   r   s       r   ÚsetzBaseCache.set?   s	   € ð  ˆtr   c                 ó   — dS )a  Works like :meth:`set` but does not overwrite the values of already
        existing keys.

        :param key: the key to set
        :param value: the value for the key
        :param timeout: the cache timeout for the key in seconds (if not
                        specified, it uses the default timeout). A timeout of
                        0 indicates that the cache never expires.
        :returns: Same as :meth:`set`, but also ``False`` for already
                  existing keys.
        :rtype: boolean
        Tr   r(   s       r   ÚaddzBaseCache.addQ   s	   € ð ˆtr   Úmappingc                 ó–   — g }|                      ¦   «         D ]1\  }}|                      |||¦  «        r|                     |¦  «         Œ2|S )a¥  Sets multiple keys and values from a mapping.

        :param mapping: a mapping with the keys/values to set.
        :param timeout: the cache timeout for the key in seconds (if not
                        specified, it uses the default timeout). A timeout of
                        0 indicates that the cache never expires.
        :returns: A list containing all keys successfully set
        :rtype: boolean
        )Úitemsr)   Úappend)r
   r,   r   Úset_keysr   r&   s         r   Úset_manyzBaseCache.set_many`   sT   € ð ˆØ!Ÿ-š-™/œ/ð 	%ð 	%‰JˆC�Ø�xŠx˜˜U GÑ,Ô,ð %Ø—’ Ñ$Ô$Ð$øØˆr   c                 óh   — g }|D ],}|                       |¦  «        r|                     |¦  «         Œ-|S )zèDeletes multiple keys at once.

        :param keys: The function accepts multiple keys as positional
                     arguments.
        :returns: A list containing all successfully deleted keys
        :rtype: boolean
        )r   r/   )r
   r   Údeleted_keysr   s       r   Údelete_manyzBaseCache.delete_manyr   sG   € ð ˆØð 	)ð 	)ˆCØ�{Š{˜3ÑÔð )Ø×#Ò# CÑ(Ô(Ð(øØÐr   c                 ó    — t          d¦  «        ‚)zÀChecks if a key exists in the cache without returning it. This is a
        cheap operation that bypasses loading the actual data on the backend.

        :param key: the key to check
        zß%s doesn't have an efficient implementation of `has`. That means it is impossible to check whether a key exists without fully loading the key's data. Consider using `self.get` explicitly if you don't care about performance.)ÚNotImplementedErrorr   s     r   ÚhaszBaseCache.has€   s   € õ "ð>ñ
ô 
ð 	
r   c                 ó   — dS )zºClears the cache.  Keep in mind that not all caches support
        completely clearing the cache.

        :returns: Whether the cache has been cleared.
        :rtype: boolean
        Tr   )r
   s    r   ÚclearzBaseCache.clear�   r   r   é   Údeltac                 ój   — |                       |¦  «        pd|z   }|                      ||¦  «        r|ndS )aH  Increments the value of a key by `delta`.  If the key does
        not yet exist it is initialized with `delta`.

        For supporting caches this is an atomic operation.

        :param key: the key to increment.
        :param delta: the delta to add.
        :returns: The new value or ``None`` for backend errors.
        r   N©r   r)   ©r
   r   r;   r&   s       r   ÚinczBaseCache.inc–   ó:   € ð —’˜#‘”Ð# ! uÑ,ˆØŸš  eÑ,Ô,Ð6ˆuˆu°$Ð6r   c                 ój   — |                       |¦  «        pd|z
  }|                      ||¦  «        r|ndS )aL  Decrements the value of a key by `delta`.  If the key does
        not yet exist it is initialized with `-delta`.

        For supporting caches this is an atomic operation.

        :param key: the key to increment.
        :param delta: the delta to subtract.
        :returns: The new value or `None` for backend errors.
        r   Nr=   r>   s       r   ÚdeczBaseCache.dec£   r@   r   )r   r   )r:   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úintr   Ú_tÚOptionalr   ÚstrÚAnyr   Úboolr   ÚListr!   ÚDictr%   r)   r+   r1   r4   r7   r9   r?   rB   r   r   r   r   r      sº  € € € € € ðð ð/ð /¨ð /ð /ð /ð /ð¨"¬+°cÔ*:ð ¸sð ð ð ð ð
�sð ˜rœvð ð ð ð ð˜#ð  $ð ð ð ð ð+˜cð + b¤g¨b¬f¤oð +ð +ð +ð +ð
5˜cð 
5 b¤g¨c°2´6¨kÔ&:ð 
5ð 
5ð 
5ð 
5ð DHðð ØðØ!œvðØ02´¸CÔ0@ðà	Œ�TÔ	ðð ð ð ð$ð �sð  2¤6ð °B´KÀÔ4Dð ÐPTð ð ð ð ð  JNðð Ø”w˜s B¤F˜{Ô+ðØ68´kÀ#Ô6Fðà	Œ�”Œðð ð ð ð$ ð ¨¬°´¬ð ð ð ð ð
�sð 
˜tð 
ð 
ð 
ð 
ð�tð ð ð ð ð7ð 7�sð 7 3ð 7¨r¬{¸3Ô/?ð 7ð 7ð 7ð 7ð7ð 7�sð 7 3ð 7¨r¬{¸3Ô/?ð 7ð 7ð 7ð 7ð 7ð 7r   r   c                   ó"   — e Zd ZdZdedefd„ZdS )Ú	NullCachezÕA cache that doesn't cache.  This can be useful for unit testing.

    :param default_timeout: a dummy parameter that is ignored but exists
                            for API compatibility with other caches.
    r   r   c                 ó   — dS )NFr   r   s     r   r7   zNullCache.has¸   s   € Øˆur   N)rC   rD   rE   rF   rJ   rL   r7   r   r   r   rP   rP   ±   s@   € € € € € ðð ð�sð ˜tð ð ð ð ð ð r   rP   )ÚtypingrH   r   rP   r   r   r   ú<module>rS      sv   ðØ Ð Ð Ð ðj7ð j7ð j7ð j7ð j7ñ j7ô j7ð j7ðZð ð ð ð �	ñ ô ð ð ð r   