%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/mako/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/mako/__pycache__/cache.cpython-312.pyc

�

���e���ddlmZejd�ZejZeddd�Gd�d�ZGd�d	�Zy
)�)�utilz
mako.cache�beakerzmako.ext.beaker_cache�BeakerCacheImplc�j�eZdZdZdZ	dZ	dZ	d�Zd�Zd�Z	d�Z
d�ZeZ	d�Z
d	�Zd
�Zd�Zd�Zd
�Zy)�Cachea�Represents a data content cache made available to the module
    space of a specific :class:`.Template` object.

    .. versionadded:: 0.6
       :class:`.Cache` by itself is mostly a
       container for a :class:`.CacheImpl` object, which implements
       a fixed API to provide caching services; specific subclasses exist to
       implement different
       caching strategies.   Mako includes a backend that works with
       the Beaker caching system.   Beaker itself then supports
       a number of backends (i.e. file, memory, memcached, etc.)

    The construction of a :class:`.Cache` is part of the mechanics
    of a :class:`.Template`, and programmatic access to this
    cache is typically via the :attr:`.Template.cache` attribute.

    Nc��t|t�r|ry||_|jj|_|jj|_i|_|j|jj�|_y�N)�
isinstance�str�template�module�__name__�id�_modified_time�	starttime�_def_regions�
_load_impl�
cache_impl�impl)�selfr�argss   �,/usr/lib/python3/dist-packages/mako/cache.py�__init__zCache.__init__As^���h��$��� ��
��/�/�*�*���!���7�7�������O�O�D�M�M�$<�$<�=��	�c�6�tj|�|�Sr	)�_cache_plugins�load�r�names  rrzCache._load_implLs���"�"�4�(��.�.rc�,�|j||dfi|��S)�cRetrieve a value from the cache, using the given creation function
        to generate a new value.N)�_ctx_get_or_create�r�key�creation_function�kws    r�
get_or_createzCache.get_or_createOs!��'�t�&�&�s�,=�t�J�r�J�Jrc��|jjs|�S|jj||fi|j	||���S)r!)r�
cache_enabledrr'�
_get_cache_kw)rr$r%�contextr&s     rr"zCache._ctx_get_or_createUsN���}�}�*�*�$�&�&�&�t�y�y�&�&��"�
�&*�&8�&8��W�&E�
�	
rc�`�|jj||fi|j|d���y)��Place a value in the cache.

        :param key: the value's key.
        :param value: the value.
        :param \**kw: cache configuration arguments.

        N)r�setr*�rr$�valuer&s    rr.z	Cache.set`s*��	��	�	�
�
�c�5�A�D�$6�$6�r�4�$@�Arc�\�|jj|fi|j|d���S)aFRetrieve a value from the cache.

        :param key: the value's key.
        :param \**kw: cache configuration arguments.  The
         backend is configured using these arguments upon first request.
         Subsequent requests that use the same series of configuration
         values will use that same backend.

        N)r�getr*�rr$r&s   rr2z	Cache.getrs+���t�y�y�}�}�S�A�D�$6�$6�r�4�$@�A�Arc�^�|jj|fi|j|d���y)aFInvalidate a value in the cache.

        :param key: the value's key.
        :param \**kw: cache configuration arguments.  The
         backend is configured using these arguments upon first request.
         Subsequent requests that use the same series of configuration
         values will use that same backend.

        N)r�
invalidater*r3s   rr5zCache.invalidate~s*��	��	�	���S�A�D�$6�$6�r�4�$@�Arc�*�|jdd��y)zWInvalidate the cached content of the "body" method for this
        template.

        �render_body��__M_defnameN�r5)rs r�invalidate_bodyzCache.invalidate_body�s��
	
���
�=��Arc�6�|jd|zd|z��y)z`Invalidate the cached content of a particular ``<%def>`` within this
        template.

        z	render_%sr8Nr:rs  r�invalidate_defzCache.invalidate_def�s��	
����d�*��d�8J��Krc�*�|j||��y)aNInvalidate a nested ``<%def>`` within this template.

        Caching of nested defs is a blunt tool as there is no
        management of scope -- nested defs that use cache tags
        need to have names unique of all other nested defs in the
        template, else their content will be overwritten by
        each other.

        r8Nr:rs  r�invalidate_closurezCache.invalidate_closure�s��	
����$��/rc���|jdd�}|s6|jjj�}|j	|�nb||j
vr|j
|}nD|jjj�}|j	|�||j
|<|r8|jjr"|j�}|jd|�|S)Nr9r+)	�popr�
cache_args�copy�updaterr�pass_context�
setdefault)rr&r+�defname�tmpl_kws     rr*zCache._get_cache_kw�s����&�&���-����m�m�.�.�3�3�5�G��N�N�2��
��)�)�
)��'�'��0�G��m�m�.�.�3�3�5�G��N�N�2��)0�D���g�&��t�y�y�-�-��l�l�n�G����y�'�2��r)r�
__module__�__qualname__�__doc__rrrrrr'r"r.�putr2r5r;r=r?r*�rrrrst���$�D��
�B���I�	�	>�/�K�	
�	B��C��
B�
B�B�L�0�rrc�4�eZdZdZd�ZdZ	d�Zd�Zd�Zd�Z	y)	�	CacheImplz:Provide a cache implementation for use by :class:`.Cache`.c��||_yr	)�cache)rrQs  rrzCacheImpl.__init__�s	����
rFc��t��)a7Retrieve a value from the cache, using the given creation function
        to generate a new value.

        This function *must* return a value, either from
        the cache, or via the given creation function.
        If the creation function is called, the newly
        created value should be populated into the cache
        under the given key before being returned.

        :param key: the value's key.
        :param creation_function: function that when called generates
         a new value.
        :param \**kw: cache configuration arguments.

        ��NotImplementedErrorr#s    rr'zCacheImpl.get_or_create�s
�� "�#�#rc��t��)r-rSr/s    rr.z
CacheImpl.set�s
��"�#�#rc��t��)z�Retrieve a value from the cache.

        :param key: the value's key.
        :param \**kw: cache configuration arguments.

        rSr3s   rr2z
CacheImpl.get��
��"�#�#rc��t��)z�Invalidate a value in the cache.

        :param key: the value's key.
        :param \**kw: cache configuration arguments.

        rSr3s   rr5zCacheImpl.invalidate�rWrN)
rrIrJrKrrEr'r.r2r5rMrrrOrO�s*��D���L��$�$$�$�$rrON)�makor�PluginLoaderr�register�register_pluginrrOrMrr�<module>r]sL���"��"�"�<�0�� �)�)����1�3D�E�e�e�P8$�8$r

Zerion Mini Shell 1.0