
     h                        d Z dZddlZddlZddlZ	 ddlmZ ddl	m
Z
mZmZmZmZmZ ddl	mZ ddl	mZ  G d	 d
e      Zd ZddZddZddZddZdej0                  dfdZddej4                  dfdZy# e$ r	 ddlmZ Y kw xY w)z?`functools.lru_cache` compatible memoizing function decorators.)
fifo_cache	lfu_cache	lru_cache	mru_cacherr_cache	ttl_cache    N)RLock   )	FIFOCacheLFUCacheLRUCacheMRUCacheRRCacheTTLCache)cached)keysc                   "    e Zd Zd Zed        Zy)_UnboundTTLCachec                 P    t        j                  | t        j                  ||       y N)r   __init__mathinf)selfttltimers      O/var/www/api/v1/venv_getwork_v1/lib/python3.12/site-packages/cachetools/func.pyr   z_UnboundTTLCache.__init__   s    $#u5    c                      y r    )r   s    r   maxsizez_UnboundTTLCache.maxsize   s    r   N)__name__
__module____qualname__r   propertyr!   r    r   r   r   r      s    6  r   r   c                       fd}|S )Nc                     rt         j                  nt         j                  } t        |t	               d      |       }fd|_        |S )NT)cachekeylockinfoc                       dS )Nr!   typedr    r-   s   r   <lambda>z+_cache.<locals>.decorator.<locals>.<lambda>    s
    w+Or   )r   typedkeyhashkeyr   r	   cache_parameters)funcr)   wrapperr(   r!   r.   s      r   	decoratorz_cache.<locals>.decorator   s:    $dmm$,,G&u#EG$GM#O r   r    )r(   r!   r.   r5   s   ``` r   _cacher6      s     r      Fc                     | t        i d|      S t        |       r t        t        d      d|      |       S t        t        |       | |      S )zDecorator to wrap a function with a memoizing callable that saves
    up to `maxsize` results based on a First In First Out (FIFO)
    algorithm.

    Nr7   )r6   callabler   r-   s     r   r   r   &   sN     b$&&	'	1vinc51'::i('599r   c                     | t        i d|      S t        |       r t        t        d      d|      |       S t        t        |       | |      S )zDecorator to wrap a function with a memoizing callable that saves
    up to `maxsize` results based on a Least Frequently Used (LFU)
    algorithm.

    Nr7   )r6   r9   r   r-   s     r   r   r   4   N     b$&&	'	0vhsmS%099hw'%88r   c                     | t        i d|      S t        |       r t        t        d      d|      |       S t        t        |       | |      S )zDecorator to wrap a function with a memoizing callable that saves
    up to `maxsize` results based on a Least Recently Used (LRU)
    algorithm.

    Nr7   )r6   r9   r   r-   s     r   r   r   B   r;   r   c                     ddl m}  |dt        d       | t        i d|      S t	        |       r t        t        d      d|      |       S t        t        |       | |      S )zDecorator to wrap a function with a memoizing callable that saves
    up to `maxsize` results based on a Most Recently Used (MRU)
    algorithm.
    r   )warnz@mru_cache is deprecated   )
stacklevelNr7   )warningsr>   DeprecationWarningr6   r9   r   )r!   r.   r>   s      r   r   r   P   s_    
 	#%7AFb$&&	'	0vhsmS%099hw'%88r   c                     | t        i d|      S t        |       r t        t        d|      d|      |       S t        t        | |      | |      S )zDecorator to wrap a function with a memoizing callable that saves
    up to `maxsize` results based on a Random Replacement (RR)
    algorithm.

    Nr7   )r6   r9   r   )r!   choicer.   s      r   r   r   a   sS     b$&&	'	7vgc6*C7@@ggv.??r   iX  c                     | t        t        ||      d|      S t        |       r t        t        d||      d|      |       S t        t        | ||      | |      S )zDecorator to wrap a function with a memoizing callable that saves
    up to `maxsize` results based on a Least Recently Used (LRU)
    algorithm with a per-item time-to-live (TTL) value.
    Nr7   )r6   r   r9   r   )r!   r   r   r.   s       r   r   r   o   s_    
 &sE2D%@@	'	<vhsC/e<WEEhwU3WeDDr   )r7   F)__doc____all__r   randomtime	threadingr	   ImportErrordummy_threading r   r   r   r   r   r   r   r   r   r6   r   r   r   r   rD   r   	monotonicr   r    r   r   <module>rO      s    E
X   & I H  x :999" e @ s$.. 
EI  &%&s   A6 6BB