[Zodb-checkins] CVS: Zope3/lib/python/Persistence - Cache.py:1.1.2.3
Jeremy Hylton
jeremy@zope.com
Tue, 5 Mar 2002 00:11:18 -0500
Update of /cvs-repository/Zope3/lib/python/Persistence
In directory cvs.zope.org:/tmp/cvs-serv5277
Modified Files:
Tag: Zope-3x-branch
Cache.py
Log Message:
Don't make _size and _inactive private variables.
They're needed by ZODB.Connection.
=== Zope3/lib/python/Persistence/Cache.py 1.1.2.2 => 1.1.2.3 ===
self.__active={}
self.__aget=self.__active.get
- self.__size=size
- self.__inactive=300
+ self._size=size
+ self._inactive=300
def __getitem__(self, oid):
o = self.__gget(oid, self)
@@ -66,11 +66,11 @@
if na < 1: return
# how many objects do we scan?
- n=min(multiple * max((na-self.__size)/10, 3), na)
+ n=min(multiple * max((na-self._size)/10, 3), na)
# how long can objects be inactive?
- inactive = self.__inactive * (
- 0.2 + 0.1 * (min(100, 8 * self.__size/na))
+ inactive = self._inactive * (
+ 0.2 + 0.1 * (min(100, 8 * self._size/na))
)
active=self.__active
@@ -119,8 +119,8 @@
na=len(active)
# how long can objects be inactive?
- inactive = self.__inactive * (
- 0.2 + 0.1 * (min(100, 8 * self.__size/na))
+ inactive = self._inactive * (
+ 0.2 + 0.1 * (min(100, 8 * self._size/na))
)
doomed=[]
@@ -190,8 +190,10 @@
class _dictdel(object):
- __slots__='oid', 'dict'
+ __slots__ = 'oid', 'dict'
- def __init__(self, oid, dict): self.oid, self.dict = oid, dict
+ def __init__(self, oid, dict):
+ self.oid, self.dict = oid, dict
+
def __call__(self, *args):
del self.dict[self.oid]