Ńň ha-Kc @ s d Z y d d k l Z Wn# e j o d d k l Z n Xd d k Z d d k Z d e f d YZ d e f d YZ d e f d YZ d S( sT Cache holder classes for Cheetah: Cache regions are defined using the #cache Cheetah directive. Each cache region can be viewed as a dictionary (keyed by cacheRegionID) handling at least one cache item (the default one). It's possible to add cacheItems in a region by using the `varyBy` #cache directive parameter as in the following example:: #def getArticle this is the article content. #end def #cache varyBy=$getArticleID() $getArticle($getArticleID()) #end cache The code above will generate a CacheRegion and add new cacheItem for each value of $getArticleID(). i˙˙˙˙( t md5Nt CacheItemc B s_ e Z d Z d Z d Z d Z d Z d Z d Z d Z d Z d Z RS( sĘ A CacheItem is a container storing: - cacheID (string) - refreshTime (timestamp or None) : last time the cache was refreshed - data (string) : the content of the cache c C s( | | _ | | _ d | _ d | _ d S( Ni ( t _cacheItemIDt _cacheStoret Nonet _refreshTimet _expiryTime( t selft cacheItemIDt cacheStore( ( s9 /usr/lib64/python2.6/site-packages/Cheetah/CacheRegion.pyt __init__' s c C s | i o t i | i j S( N( R t time( R ( ( s9 /usr/lib64/python2.6/site-packages/Cheetah/CacheRegion.pyt hasExpired- s c C s | | _ d S( N( R ( R R ( ( s9 /usr/lib64/python2.6/site-packages/Cheetah/CacheRegion.pyt setExpiryTime0 s c C s | i S( N( R ( R ( ( s9 /usr/lib64/python2.6/site-packages/Cheetah/CacheRegion.pyt getExpiryTime3 s c C s/ t i | _ | i i | i | | i d S( N( R R R t setR R ( R t data( ( s9 /usr/lib64/python2.6/site-packages/Cheetah/CacheRegion.pyt setData6 s c C s | i S( N( R ( R ( ( s9 /usr/lib64/python2.6/site-packages/Cheetah/CacheRegion.pyt getRefreshTime: s c C s | i i | i S( N( R t getR ( R ( ( s9 /usr/lib64/python2.6/site-packages/Cheetah/CacheRegion.pyt getData= s c C s | i p d S( s+ Can be overridden to implement edge-cachingt ( R ( R ( ( s9 /usr/lib64/python2.6/site-packages/Cheetah/CacheRegion.pyt renderOutputA s c C s | i i | i d | _ d S( N( R t deleteR R R ( R ( ( s9 /usr/lib64/python2.6/site-packages/Cheetah/CacheRegion.pyt clearE s ( t __name__t __module__t __doc__R R R R R R R R R ( ( ( s9 /usr/lib64/python2.6/site-packages/Cheetah/CacheRegion.pyR s t _CacheDataStoreWrapperc B s/ e Z d Z d Z d Z d d Z RS( c C s | | _ | | _ d S( N( t _dataStoret _keyPrefix( R t dataStoret keyPrefix( ( s9 /usr/lib64/python2.6/site-packages/Cheetah/CacheRegion.pyR J s c C s | i i | i | S( N( R R R ( R t key( ( s9 /usr/lib64/python2.6/site-packages/Cheetah/CacheRegion.pyR N s c C s | i i | i | d S( N( R R R ( R R! ( ( s9 /usr/lib64/python2.6/site-packages/Cheetah/CacheRegion.pyR Q s i c C s$ | i i | i | | d | d S( NR ( R R R ( R R! t valR ( ( s9 /usr/lib64/python2.6/site-packages/Cheetah/CacheRegion.pyR T s ( R R R R R R ( ( ( s9 /usr/lib64/python2.6/site-packages/Cheetah/CacheRegion.pyR I s t CacheRegionc B s> e Z d Z e Z d d d Z d Z d Z d Z RS( sŐ A `CacheRegion` stores some `CacheItem` instances. This implementation stores the data in the memory of the current process. If you need a more advanced data store, create a cacheStore class that works with Cheetah's CacheStore protocol and provide it as the cacheStore argument to __init__. For example you could use Cheetah.CacheStore.MemcachedCacheStore, a wrapper around the Python memcached API (http://www.danga.com/memcached). R c C sl t | _ | | _ | | _ | p t i i } n | | _ t | d | d | d | _ h | _ d S( NR t :( t Truet _isNewt _regionIDt _templateCacheIdPrefixt Cheetaht CacheStoret MemoryCacheStoreR R t _wrappedCacheDataStoret _cacheItems( R t regionIDt templateCacheIdPrefixR ( ( s9 /usr/lib64/python2.6/site-packages/Cheetah/CacheRegion.pyR d s c C s | i S( N( R&