Jo^>ddlmZejdZejZedddGddZGdd Zd S) )utilz mako.cachebeakerzmako.ext.beaker_cacheBeakerCacheImplcleZdZdZdZ dZ dZ dZdZdZ dZ dZ e Z dZ d Zd Zd Zd Zd ZdS)CacheaRepresents 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. Nct|tr|rdS||_|jj|_|jj|_i|_| |jj |_ dSN) isinstancestrtemplatemodule__name__id_modified_time starttime _def_regions _load_impl cache_implimpl)selfr argss /srv/buildsys-work-dir/castor/build_node/builder-2/WGSG1/unpkd_srcs/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/mako/cache.py__init__zCache.__init__Ase h $ $   F  /*!7OODM$<== cFt||Sr )_cache_pluginsloadrnames 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_createrkeycreation_functionkws r get_or_createzCache.get_or_createOs$'t&s,=tJJrJJJrc ~|jjs |S|jj||fi|||S)r!)r cache_enabledrr' _get_cache_kw)rr$r%contextr&s rr"zCache._ctx_get_or_createUs\}* '$$&& &&ty& "  &*&8&8W&E&E   rc V|jj||fi||ddS)Place a value in the cache. :param key: the value's key. :param value: the value. :param \**kw: cache configuration arguments. N)rsetr*rr$valuer&s rr.z Cache.set`s8  c5AAD$6$6r4$@$@AAAAArc P|jj|fi||dS)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)rgetr*rr$r&s rr2z Cache.getrs0ty}SAAD$6$6r4$@$@AAArc T|jj|fi||ddS)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~s7  SAAD$6$6r4$@$@AAAAArc4|dddS)zWInvalidate the cached content of the "body" method for this template. render_body __M_defnameNr5)rs rinvalidate_bodyzCache.invalidate_bodys  =AAAAArc@|d|zd|zdS)z`Invalidate the cached content of a particular ``<%def>`` within this template. z render_%sr8Nr:rs rinvalidate_defzCache.invalidate_defs*  d* d8JKKKKKrc4|||dS)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 rinvalidate_closurezCache.invalidate_closures  $/////rc|dd}|s4|jj}||nT||jvr|j|}n=|jj}||||j|<|r6|jjr*|}|d||S)Nr9r+) popr cache_argscopyupdaterr pass_context setdefault)rr&r+defnametmpl_kws rr*zCache._get_cache_kws&&-- 1m.3355G NN2     ) ) )'0GGm.3355G NN2   )0D g &  3ty- 3llnnG   y' 2 2 2r)r __module__ __qualname____doc__rrrrrr'r"r.putr2r5r;r=r?r*rrrrs$ D BI  > > >///KKK     B B B C B B B B B BBBBLLL 0 0 0rrc6eZdZdZdZdZ dZdZdZdZ dS) CacheImplz:Provide a cache implementation for use by :class:`.Cache`.c||_dSr )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_creates "###rc t)r-rSr/s rr.z CacheImpl.sets"###rc t)zRetrieve a value from the cache. :param key: the value's key. :param \**kw: cache configuration arguments. rSr3s rr2z CacheImpl.get"###rc t)zInvalidate a value in the cache. :param key: the value's key. :param \**kw: cache configuration arguments. rSr3s rr5zCacheImpl.invalidaterWrN) rrIrJrKrrEr'r.r2r5rMrrrOrOsqDDL$$$$$$$$$$$$$$$rrON)makor PluginLoaderrregisterregister_pluginrrOrMrrr]s""<00 )13DEEEeeeeeeeeP8$8$8$8$8$8$8$8$8$8$r