????

Your IP : 3.138.117.11


Current Path : /opt/cloudlinux/venv/lib/python3.11/site-packages/clwpos/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib/python3.11/site-packages/clwpos/__pycache__/scoped_cache.cpython-311.pyc

�

P��rCX���L�dZddlmZddlmZiZdaed���Zd�Zd�Z	dS)	aO
This is a simple wrapper around lru_cache which allows
us to enable caching only within some scope defined by contextmanager

It makes it easier to cache some functions e.g. only inside wpos-user get
scope and still be able to get fresh data in wpos-user enable
where cached commands might return different results because of outside
�)�contextmanager)�	lru_cacheFc#�K�trtd���	dadV�t��dadS#t��dawxYw)zK
    This context manager sets global marker
    which enables caching
    znested scopes are not supportedTNF)�CACHING_ENABLED�RuntimeError�_clear_cache���py/clwpos/scoped_cache.py�enable_cachingrsa�����>��<�=�=�=� ���
�������������	���������s	�2�Ac�f�t���D]}|����dS)z1
    Clear cache of all registered functions
    N)�_CACHED_FUNCTIONS�values�cache_clear)�funcs rrr"s>��"�(�(�*�*������������r
c�^���fd�}t�����}|t�j<|S)zP
    Primary code which decides should we return cached
    result or fresh
    c�P��trt�j|i|��S�|i|��S)N)rr�__name__)�args�kwargsrs  �r�_wrapperz!cached_in_scope.<locals>._wrapper/s;����	E�$�T�]�3�T�D�V�D�D�D��t�T�$�V�$�$�$r
)rrr)rr�cached_funcs`  r�cached_in_scoper*sC���
%�%�%�%�%�
�)�+�+�d�#�#�K�'2��d�m�$��Or
N)
�__doc__�
contextlibr�	functoolsrrrrrrr	r
r�<module>rs�����&�%�%�%�%�%������������ � ��� �"�������r