
    \j                     $    d dl mZ  G d d      Zy)    )OrderedDictc                   *    e Zd ZdZd Zd Z	 d Zd Zy)SimpleLRUCachezA dictionary-based cache that removes the oldest entries when its limit is exceeded.
    Values are only refreshed by writing, not by reading. Not thread-safe.
    c                 0    || _         t               | _        y N)capacityr   cache)selfr   s     A/root/env/lib/python3.12/site-packages/ldclient/impl/lru_cache.py__init__zSimpleLRUCache.__init__   s      ]
    c                 8    | j                   j                  |      S r   )r	   get)r
   keys     r   r   zSimpleLRUCache.get   s    zz~~c""r   c                     || j                   v }|r| j                   j                  |       n>t        | j                         | j                  k\  r| j                   j	                  d       || j                   |<   |S )NF)last)r	   move_to_endlenr   popitem)r
   r   valuefounds       r   putzSimpleLRUCache.put   s`    

"JJ""3'4::$--/

""".

3r   c                 8    | j                   j                          y r   )r	   clear)r
   s    r   r   zSimpleLRUCache.clear   s    

r   N)__name__
__module____qualname____doc__r   r   r   r    r   r   r   r      s     ##r   r   N)collectionsr   r   r   r   r   <module>r!      s    # r   