MINI SHELL

Server : Apache/2.2.2 (Fedora)
System : Linux App1.pathumtani.go.th 2.6.20-1.2320.fc5smp #1 SMP Tue Jun 12 19:40:16 EDT 2007 i686
User : apache ( 48)
PHP Version : 5.2.9
Disable Function : NONE
Directory :  /proc/self/root/usr/lib/python2.4/site-packages/mx/Misc/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/self/root/usr/lib/python2.4/site-packages/mx/Misc/Cache.pyc
mς
›KX;c@sJdZdkZdkZdZdgeZdeZdZdZdZ	dfd	„ƒYZ
[
d
fd„ƒYZeƒZdfd
„ƒYZe
djo­eddddƒZdZxdGeGeiGeiGeiGeiiƒGHedZeiddƒeidƒeidƒeiddƒeidƒeiddƒeiddƒeidƒeidƒeiddƒeidddƒeidƒeidƒeidƒeiddƒeiddƒeiddƒeiddƒeiedƒeieddƒeieddƒeieƒq·WndS(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.
Niiiiiit_modinitcBs}tZdkZeddeƒZxWeeƒD]I\ZZe	ei
eƒddƒee<eoeGdGeeGHq.q.WRS(Niif1.0i s
. weight =(
t__name__t
__module__tmathtfrangetMAXLOCALITYtltirangetitfactortinttexpt_weightst_debug(((t1/usr/lib/python2.4/site-packages/mx/Misc/Cache.pyRs	
!t	NotCachedcBstZdZd„ZeZRS(sp A singleton that can be used in conjunction with the .get()
        method of Cache. It behaves like None.
    cCsdS(Ni((tself((Rt__nonzero__)s(RRt__doc__Rt__len__(((RR$s	tCachecBsƒtZdZeZeZeZdddd„Zee	d„Z
d„Zee
d„Zee
d„ZeZeZd	„ZeZRS(
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Θii2cCs|||_||_|tjotdt‚n||_d|_d|_d|_d|_	h|_
g|_g|_dS(Nslocality must be <= %ii(
t
max_cachesizeRtmax_elementsizetlocalityRt
ValueErrort	cachesizetcutstmissesthitstdatatput_historytget_history(RRRR((Rt__init__Ds		
							cCsto	dGHn|i}
h}
|
i}|i}xU|i|iD]B}	||	ƒoqCny||	|
|	<WqCt
j
oqCXqCWt|
ƒ}
to
dG|
GHn|
||i
|jo)h}t}|i}xTt|i|iƒD];\}}	||	ƒpqξn||	dƒ||||	<qξWt|iƒdƒ}to
dG|GHnxE|t|ƒd D]/\}	}todG|	GdG|GHn|
|	=qkWt|
ƒ}
|
||i
|jo$to	d	GHn|
iƒd}
qκn|
|_|
|_|id|_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:iis   Ranking:is   Deletings
with weight =s&   Did not work, going the hard way...N(R
RRtnewdatathas_keyt	known_keyRRRtidtKeyErrortlentNOMRtDENOMtdRtweightstgettd_getRRtsortedbytitemstrankingtweighttclearR(RR'R(R0R#R)R/RR,R$RR*RR!((RtcutWsX				
	
	

	
		cCsd|_h|_g|_dS(s Clear the cache.
        iN(RRRthistory(R((RR1–s		cCs†|ii|dƒ}|djo|id|_|Sn|ii	|ƒt
|iƒ|jo|i|i3n|i
d|_
|S(sW Get a value from the cache or return default if it is
            not cached.
        iN(RRR+R$tNonetitemRtdefaultRtappendR&tHISTORYLIMITRR(RR$R6R8R5((RR+žs
cCsΚ||ƒ}||ijodSn|ii|ƒpJto
dG|GHn|i	d|_	}||i
jo|iƒqn||i|<|ii
|ƒt|iƒ|jo|i|i3ndS(s= Add a value to the cache or update an existing one.
        Ns  Addingi(tsizeoftvaluetsizeRRRR"R$R
RRR2RR7R&R8R(RR$R:R9R8RR;((Rtput²s

cCs(y|i|=Wntj
onXdS(sv Delete an entry from the cache.

            It is not an error, if the entry is not currently in the cache.
        N(RRR$R%(RR$((RtdeleteΞs
(RRRR4RRRR R'R(R2R1RR8R+R9R<taddtupdateR=tremove(((RR1s?		t__main__i
idRitRounditxiΘ(Rtsystmx.Tools.NewBuiltinstmxRRR8R(R'R
RRRRtcRRRRRtkeysR<R+(
R'RGR
RRRRRRDRR8R(RF((Rt?sR		

		­
5









Anon7 - 2021