
    g                          S SK Jr  \R                  " S5      r\R                  r\" SSS5         " S S5      r " S S	5      rg
)    )utilz
mako.cachebeakerzmako.ext.beaker_cacheBeakerCacheImplc                   r    \ rS rSrSrSr Sr Sr S rS r	S r
S rS r\r S	 rS
 rS rS rS rS rSrg)Cache   a  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                    [        U[        5      (       a  U(       a  g Xl        UR                  R                  U l        UR                  R                  U l        0 U l        U R                  U R                  R                  5      U l        g N)
isinstancestrtemplatemodule__name__id_modified_time	starttime_def_regions
_load_impl
cache_implimpl)selfr   argss      R/Users/Alptekin/Desktop/izin_takip/venv/lib/python3.13/site-packages/mako/cache.py__init__Cache.__init__A   s_     h$$ //**!77OODMM$<$<=	    c                 8    [         R                  U5      " U 5      $ r
   )_cache_pluginsloadr   names     r   r   Cache._load_implL   s    ""4(..r   c                 *    U R                   " XS40 UD6$ )[Retrieve 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_createCache.get_or_createO   s     &&stJrJJr   c                     U R                   R                  (       d  U" 5       $ U R                  R                  " X40 U R	                  XC5      D6$ )r$   )r   cache_enabledr   r*   _get_cache_kw)r   r'   r(   contextr)   s        r   r%   Cache._ctx_get_or_createU   sG     }}**$&&yy&&
&*&8&8&E
 	
r   c                 ^    U R                   R                  " X40 U R                  US5      D6  g)Place a value in the cache.

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

N)r   setr.   r   r'   valuer)   s       r   r3   	Cache.set`   s&     			cAD$6$6r4$@Ar   c                 \    U R                   R                  " U40 U R                  US5      D6$ )a  Retrieve 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.   r   r'   r)   s      r   r8   	Cache.getr   s)     yy}}SAD$6$6r4$@AAr   c                 ^    U R                   R                  " U40 U R                  US5      D6  g)a  Invalidate 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.   r9   s      r   r<   Cache.invalidate~   s(     			SAD$6$6r4$@Ar   c                 $    U R                  SSS9  g)zGInvalidate the cached content of the "body" method for this
template.

render_body__M_defnameNr<   )r   s    r   invalidate_bodyCache.invalidate_body   s    
 	=Ar   c                 0    U R                  SU-  SU-  S9  g)zPInvalidate the cached content of a particular ``<%def>`` within this
template.

z	render_%sr@   NrB   r    s     r   invalidate_defCache.invalidate_def   s     	d*d8JKr   c                 "    U R                  XS9  g)a  Invalidate 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.

r@   NrB   r    s     r   invalidate_closureCache.invalidate_closure   s     	/r   c                    UR                  SS 5      nU(       d6  U R                  R                  R                  5       nUR	                  U5        ObX0R
                  ;   a  U R
                  U   nOCU R                  R                  R                  5       nUR	                  U5        X@R
                  U'   U(       a=  U R                  R                  (       a"  UR                  5       nUR                  SU5        U$ )NrA   r/   )	popr   
cache_argscopyupdater   r   pass_context
setdefault)r   r)   r/   defnametmpl_kws        r   r.   Cache._get_cache_kw   s    &&-mm..335GNN2)))''0Gmm..335GNN2)0g&tyy--llnGy'2r   )r   r   r   r   r   )r   
__module____qualname____firstlineno____doc__r   r   r   r   r   r*   r%   r3   putr8   r<   rC   rF   rI   r.   __static_attributes__ r   r   r   r      st    $ D 
B I		>/K	
	B C
B
BBL0r   r   c                   <    \ rS rSrSrS rSr S rS rS r	S r
S	rg
)	CacheImpl   z:Provide a cache implementation for use by :class:`.Cache`.c                     Xl         g r
   cache)r   ra   s     r   r   CacheImpl.__init__   s    
r   Fc                     [        5       e)a  Retrieve 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       r   r*   CacheImpl.get_or_create   s      "##r   c                     [        5       e)r2   rd   r4   s       r   r3   CacheImpl.set   s     "##r   c                     [        5       e)zmRetrieve a value from the cache.

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

rd   r9   s      r   r8   CacheImpl.get        "##r   c                     [        5       e)zmInvalidate a value in the cache.

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

rd   r9   s      r   r<   CacheImpl.invalidate   rk   r   r`   N)r   rU   rV   rW   rX   r   rP   r*   r3   r8   r<   rZ   r[   r   r   r]   r]      s*    D L$$$$$r   r]   N)makor   PluginLoaderr   registerregister_pluginr   r]   r[   r   r   <module>rr      sJ    ""<0 )) 13D Ee eP8$ 8$r   