o
    ÑtBh²  ã                   @   s(   d dl Z ddlmZ G dd„ deƒZdS )é    Né   )ÚCachec                   @   s>   e Zd ZdZddd„Zejfdd„Zejfdd„Zd	d
„ ZdS )Ú	FIFOCachez/First In First Out (FIFO) cache implementation.Nc                 C   s   t  | ||¡ t ¡ | _d S ©N)r   Ú__init__ÚcollectionsÚOrderedDictÚ_FIFOCache__order)ÚselfÚmaxsizeÚ	getsizeof© r   úf/var/www/html/riverr-enterprise-integrations-main/venv/lib/python3.10/site-packages/cachetools/fifo.pyr   	   s   zFIFOCache.__init__c                 C   s>   || ||ƒ z	| j  |¡ W d S  ty   d | j |< Y d S w r   )r	   Úmove_to_endÚKeyError)r
   ÚkeyÚvalueÚcache_setitemr   r   r   Ú__setitem__   s   ÿzFIFOCache.__setitem__c                 C   s   || |ƒ | j |= d S r   )r	   )r
   r   Úcache_delitemr   r   r   Ú__delitem__   s   
zFIFOCache.__delitem__c                 C   sD   z	t t| jƒƒ}W n ty   tdt| ƒj ƒd‚w ||  |¡fS )z9Remove and return the `(key, value)` pair first inserted.z%s is emptyN)ÚnextÚiterr	   ÚStopIterationr   ÚtypeÚ__name__Úpop)r
   r   r   r   r   Úpopitem   s   ÿzFIFOCache.popitemr   )	r   Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r   r   r   r   r      s    
r   )r   Úcacher   r   r   r   r   r   Ú<module>   s    