PNG  IHDR;IDATxܻn0K )(pA 7LeG{ §㻢|ذaÆ 6lذaÆ 6lذaÆ 6lom$^yذag5bÆ 6lذaÆ 6lذa{ 6lذaÆ `}HFkm,mӪôô! x|'ܢ˟;E:9&ᶒ}{v]n&6 h_tڠ͵-ҫZ;Z$.Pkž)!o>}leQfJTu іچ\X=8Rن4`Vwl>nG^is"ms$ui?wbs[m6K4O.4%/bC%t Mז -lG6mrz2s%9s@-k9=)kB5\+͂Zsٲ Rn~GRC wIcIn7jJhۛNCS|j08yiHKֶۛkɈ+;SzL/F*\Ԕ#"5m2[S=gnaPeғL lذaÆ 6l^ḵaÆ 6lذaÆ 6lذa; _ذaÆ 6lذaÆ 6lذaÆ RIENDB`  Kc@sXdZddlZddljZddljZddlmZmZddl j j Z ddl j j Z ddlj jZddlj jZiejd6ejd6ejd6e jd6e jd6ejd 6ejd 6ZiZiZyddlZx ejd D]ZyBejZ ej!Z!e!ekrBed e!ne ee!sN( tcallableR RRR RRRt remove_value(RRR RR((s0/usr/lib/python2.7/site-packages/beaker/cache.pytregion_invalidateys"    RcBseZdZdddddZedZdZeZdZ e Z dZ e Z dZ ejdd Zd Zd Zd Zd ZdZdZRS(sIFront-end to the containment API implementing a data cache. :param namespace: the namespace of this Cache :param type: type of cache to use :param expire: seconds to keep cached data :param expiretime: seconds to keep cached data (legacy support) :param starttime: time when cache was cache was RcKsy&t|}t|tr%|nWn!tk rItd|nX||||_|pe||_||_||_dS(NsUnknown cache implementation %r( tclsmapt isinstanceRtKeyErrort TypeErrorRt expiretimet starttimetnsargs(tselfRttypeR-R.texpireR/tcls((s0/usr/lib/python2.7/site-packages/beaker/cache.pyt__init__s    cCsL|t|}y t|SWn)tk rG|||t|<}|SXdS(N(Rtcache_managersR+(R3RtkwtkeyR((s0/usr/lib/python2.7/site-packages/beaker/cache.pyRs   cKs|j||j|dS(N(t _get_valuet set_value(R0R7tvalueR6((s0/usr/lib/python2.7/site-packages/beaker/cache.pytputscKs|j||jS(s*Retrieve a cached value from the container(R8R(R0R7R6((s0/usr/lib/python2.7/site-packages/beaker/cache.pyRscKs/|j||}|jr+|jndS(N(R8thas_current_valuet clear_value(R0R7R6t mycontainer((s0/usr/lib/python2.7/site-packages/beaker/cache.pyR's cKs|t|tr$|jdd}nd|kr@|j||S|jd|j|jd|jtj||j |S(NtasciitbackslashreplaceR1R-R.( R*tunicodetencodet_legacy_get_valuet setdefaultR-R.t containertValueR(R0R7R6((s0/usr/lib/python2.7/site-packages/beaker/cache.pyR8s sSpecifying a 'type' and other namespace configuration with cache.get()/put()/etc. is deprecated. Specify 'type' and other namespace configuration to cache_manager.get_cache() and/or the Cache constructor instead.c Ks|jd|j}|jdd}|jdd}|jj}|j|t|jjd||}|j|d|d|d|S(NR-R.R R1( tpopR-R"R/tcopytupdateRRR8( R0R7R1R6R-R.R tkwargstc((s0/usr/lib/python2.7/site-packages/beaker/cache.pyRCs cCs|jjdS(s'Clear all the values from the namespaceN(Rtremove(R0((s0/usr/lib/python2.7/site-packages/beaker/cache.pytclearscCs |j|S(N(R(R0R7((s0/usr/lib/python2.7/site-packages/beaker/cache.pyt __getitem__scCs|j|jS(N(R8R<(R0R7((s0/usr/lib/python2.7/site-packages/beaker/cache.pyt __contains__scCs ||kS(N((R0R7((s0/usr/lib/python2.7/site-packages/beaker/cache.pythas_keyscCs|j|dS(N(R'(R0R7((s0/usr/lib/python2.7/site-packages/beaker/cache.pyt __delitem__scCs|j||dS(N(R;(R0R7R:((s0/usr/lib/python2.7/site-packages/beaker/cache.pyt __setitem__ sN(t__name__t __module__t__doc__R"R4t classmethodRR;R9RRR'RLR8Rt deprecatedRCRMRNRORPRQRR(((s0/usr/lib/python2.7/site-packages/beaker/cache.pyRs$           t CacheManagercBsGeZdZdZdZdZdZdZdZRS(cKs2||_|jdi|_tj|jdS(sInitialize a CacheManager object with a set of options Options should be parsed with the :func:`~beaker.util.parse_cache_config_options` function to ensure only valid options are used. R N(RJRGtregionsR RI(R0RJ((s0/usr/lib/python2.7/site-packages/beaker/cache.pyR4s cKs,|jj}|j|tj||S(N(RJRHRIRR(R0tnameRJR6((s0/usr/lib/python2.7/site-packages/beaker/cache.pyt get_caches cCs?||jkr"td|n|j|}tj||S(NsCache region not configured: %s(RYRRR(R0RZRR6((s0/usr/lib/python2.7/site-packages/beaker/cache.pytget_cache_region"s cGs t||S(sDecorate a function to cache itself using a cache region The region decorator requires arguments if there are more than 2 of the same named function, in the same module. This is because the namespace used for the functions cache is based on the functions name and the module. Example:: # Assuming a cache object is available like: cache = CacheManager(dict_of_config_options) def populate_things(): @cache.region('short_term', 'some_data') def load(search_term, limit, offset): return load_the_data(search_term, limit, offset) return load('rabbits', 20, 0) .. note:: The function being decorated must only be called with positional arguments. (R#(R0RR ((s0/usr/lib/python2.7/site-packages/beaker/cache.pyR(scGst|||St|r:|s.|j}n|j}n|sOtdn |j|}|j||}djd|D}|j|dS(sLInvalidate a cache region namespace or decorated function This function only invalidates cache spaces created with the cache_region decorator. :param namespace: Either the namespace of the result to invalidate, or the name of the cached function :param region: The region the function was cached to. If the function was cached to a single region then this argument can be None :param args: Arguments that were used to differentiate the cached function as well as the arguments passed to the decorated function Example:: # Assuming a cache object is available like: cache = CacheManager(dict_of_config_options) def populate_things(invalidate=False): @cache.region('short_term', 'some_data') def load(search_term, limit, offset): return load_the_data(search_term, limit, offset) # If the results should be invalidated first if invalidate: cache.region_invalidate(load, None, 'some_data', 'rabbits', 20, 0) return load('rabbits', 20, 0) s1Region or callable function namespace is requiredRcss|]}t|VqdS(N(R(R$R%((s0/usr/lib/python2.7/site-packages/beaker/cache.pys wsN( R(R&R RRRYR[RR'(R0RRR RR((s0/usr/lib/python2.7/site-packages/beaker/cache.pyR(Gs#    cs>dgdjd|Dfd}|S(sRDecorate a function to cache itself with supplied parameters :param args: Used to make the key unique for this function, as in region() above. :param kwargs: Parameters to be passed to get_cache(), will override defaults Example:: # Assuming a cache object is available like: cache = CacheManager(dict_of_config_options) def populate_things(): @cache.cache('mycache', expire=15) def load(search_term, limit, offset): return load_the_data(search_term, limit, offset) return load('rabbits', 20, 0) .. note:: The function being decorated must only be called with positional arguments. Rcss|]}t|VqdS(N(R(R$R%((s0/usr/lib/python2.7/site-packages/beaker/cache.pys scs:tjfd}|_|S(Ncsmds#jdscs S(N(((R R (s0/usr/lib/python2.7/site-packages/beaker/cache.pyR sR (R[RR(R RR (RR R7RJRR0(R s0/usr/lib/python2.7/site-packages/beaker/cache.pyRs  !(RRR(R R(RR7RJR0(R Rs0/usr/lib/python2.7/site-packages/beaker/cache.pyR!s N(R"R(R0R RJR!((RR7RJR0s0/usr/lib/python2.7/site-packages/beaker/cache.pyRzs  cOsE|j}|j||}djd|D}|j|dS(sInvalidate a cache decorated function This function only invalidates cache spaces created with the cache decorator. :param func: Decorated function to invalidate :param args: Used to make the key unique for this function, as in region() above. :param kwargs: Parameters that were passed for use by get_cache(), note that this is only required if a ``type`` was specified for the function Example:: # Assuming a cache object is available like: cache = CacheManager(dict_of_config_options) def populate_things(invalidate=False): @cache.cache('mycache', type="file", expire=15) def load(search_term, limit, offset): return load_the_data(search_term, limit, offset) # If the results should be invalidated first if invalidate: cache.invalidate(load, 'mycache', 'rabbits', 20, 0, type="file") return load('rabbits', 20, 0) Rcss|]}t|VqdS(N(R(R$R%((s0/usr/lib/python2.7/site-packages/beaker/cache.pys sN(RR[RR'(R0R R RJRRR((s0/usr/lib/python2.7/site-packages/beaker/cache.pyt invalidates! ( RSRTR4R[R\RR(RR](((s0/usr/lib/python2.7/site-packages/beaker/cache.pyRXs     3 ,(4RUtwarningstbeaker.containerREt beaker.utilRtbeaker.exceptionsRRtbeaker.ext.memcachedtextt memcachedtbeaker.ext.databasetdatabasetbeaker.ext.sqlatsqlatbeaker.ext.googletgoogletMemoryNamespaceManagertDBMNamespaceManagertFileNamespaceManagertMemcachedNamespaceManagertDatabaseNamespaceManagertSqlaNamespaceManagertGoogleNamespaceManagerR)R R5t pkg_resourcestiter_entry_pointst entry_pointtloadtNamespaceManagerRZt SyntaxErrortsysRR*texc_infot tracebackRttbt print_exctwarntgetvaluetRuntimeWarningt ImportErrorR#R(tobjectRRX(((s0/usr/lib/python2.7/site-packages/beaker/cache.pyt s^                   3 2c