L i- dZdZddlZddlZddlZddlZddlmZddlm Z m Z m Z m Z m Z ddlmZddlmZGd d e Zd ZddZddZddZd ej*d fdZd dej.d fdZy)z?`functools.lru_cache` compatible memoizing function decorators.) fifo_cache lfu_cache lru_cacherr_cache ttl_cacheN) Condition) FIFOCacheLFUCacheLRUCacheRRCacheTTLCache)cached)keysc"eZdZdZedZy)_UnboundTTLCachecPtj|tj||yN)r__init__mathinf)selfttltimers U/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/cachetools/func.pyrz_UnboundTTLCache.__init__s$#u5cyr)rs rmaxsizez_UnboundTTLCache.maxsizesrN)__name__ __module__ __qualname__rpropertyrrrrrrs6rrcfd}|S)Ncrtjntj}t|t d|}fd|_|S)NT)cachekey conditioninfocdS)Nrtypedrr+srz+_cache..decorator..s w+Or)rtypedkeyhashkeyrrcache_parameters)funcr'wrapperr&rr,s r decoratorz_cache..decorators;$dmm$,,P&u#4PQUV#O rr)r&rr,r3s``` r_cacher4s rFc| tid|St|rttdd||Stt|||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. Nr5)r4callabler r+s rrr#sN b$&& ' 1vinc51'::i('599rc| tid|St|rttdd||Stt|||S)zDecorator to wrap a function with a memoizing callable that saves up to `maxsize` results based on a Least Frequently Used (LFU) algorithm. Nr5)r4r7r r+s rrr1N b$&& ' 0vhsmS%099hw'%88rc| tid|St|rttdd||Stt|||S)zDecorator to wrap a function with a memoizing callable that saves up to `maxsize` results based on a Least Recently Used (LRU) algorithm. Nr5)r4r7r r+s rrr?r9rc| tid|St|rttd|d||Stt||||S)zDecorator to wrap a function with a memoizing callable that saves up to `maxsize` results based on a Random Replacement (RR) algorithm. Nr5)r4r7r )rchoicer,s rrrMsS b$&& ' 7vgc6*C7@@ggv.??riXc|tt||d|St|rttd||d||Stt|||||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. Nr5)r4rr7r)rrrr,s rrr[s_ &sE2D%@@ ' rFspE K >>x : 9 9e @s$.. Er