Tryag File Manager
Home
-
Turbo Force
Current Path :
/
usr
/
lib
/
python2.4
/
site-packages
/
mx
/
BeeBase
/
Upload File :
New :
File
Dir
//usr/lib/python2.4/site-packages/mx/BeeBase/Cache.pyc
mς KX;c @ sJ d Z d k Z d k Z d Z d g e Z d e Z d Z d Z d Z d f d YZ [ d f d YZ e Z d f d YZ e d j oe d d d d Z d Z xd Ge Ge i Ge i Ge i Ge i i GHe d Z e i d d e i d e i d e i d d e i d e i d d e i d d e i d e i d e i d d e i d d d e i d e i d e i d e i d d e i d d e i d d e i d d e i e d e i e d d e i e d d e i e q· Wn d S( sΰ Cache - Generic cache implementation Copyright (c) 1998-2000, Marc-Andre Lemburg; mailto:mal@lemburg.com See the documentation for further information on copyrights, or contact the author. All Rights Reserved. Ni i i i i i t _modinitc B s} t Z d k Z e d d e Z xW e e D]I \ Z Z e e i e d d e e <e o e Gd Ge e GHq. q. WRS( Ni i f1.0i s . weight =( t __name__t __module__t matht franget MAXLOCALITYt lt iranget it factort intt expt _weightst _debug( ( ( t4 /usr/lib/python2.4/site-packages/mx/BeeBase/Cache.pyR s !t NotCachedc B s t Z d Z d Z e Z RS( sp A singleton that can be used in conjunction with the .get() method of Cache. It behaves like None. c C s d S( Ni ( ( t self( ( R t __nonzero__) s ( R R t __doc__R t __len__( ( ( R R $ s t Cachec B s t Z d Z e Z e Z e Z d d d d Z e e d Z d Z e e d Z e e d Z e Z e Z d Z e Z RS( s$ Tunable cache implementation The following parameters influence the cache behaviour: - max_cachesize: the cache will be cut smaller when this limit is reached - max_elementsize: elements with size greate than this limit will not be cached - locality: these many elements will be looked at in the hit statistics to determine how important a specific entry is iΘ i i2 c C s| | | _ | | _ | t j o t d t n | | _ d | _ d | _ d | _ d | _ h | _ g | _ g | _ d S( Ns locality must be <= %ii ( t max_cachesizeR t max_elementsizet localityR t ValueErrort cachesizet cutst missest hitst datat put_historyt get_history( R R R R ( ( R t __init__D s c C s t o d GHn | i } h } | i } | i } xU | i | i D]B } | | o qC n y | | | | <WqC t j o qC XqC Wt | } t o d G| GHn | | | i | j o)h } t } | i } xT t | i | i D]; \ } } | | p qξ n | | d | | | | <qξ Wt | i d } t o d G| GHn xE | t | d D]/ \ } } t o d G| Gd G| GHn | | =qkWt | } | | | i | j o$ t o d GHn | i d } qκn | | _ | | _ | i d | _ d S( sk Force a cut of the cache's contents. This will make room for at least one new entry. s Cutting down cache size...s$ Size after cut to recent history:i i s Ranking:i s Deletings with weight =s&