[Zope3-checkins] CVS: Zope3/src/zodb - connection.py:1.31 serialize.py:1.20

Jeremy Hylton jeremy@zope.com
Wed, 16 Apr 2003 18:06:51 -0400


Update of /cvs-repository/Zope3/src/zodb
In directory cvs.zope.org:/tmp/cvs-serv22387/zodb

Modified Files:
	connection.py serialize.py 
Log Message:
Update cache clients and implementation to use new ICache interface.


=== Zope3/src/zodb/connection.py 1.30 => 1.31 ===
--- Zope3/src/zodb/connection.py:1.30	Thu Apr 10 13:23:49 2003
+++ Zope3/src/zodb/connection.py	Wed Apr 16 18:06:20 2003
@@ -153,7 +153,7 @@
         obj._p_changed = None # make sure it is a ghost
         obj._p_serial = serial
 
-        self._cache[oid] = obj
+        self._cache.set(oid, obj)
         if oid == ZERO:
             # Keep a reference to the root so that the pickle cache
             # won't evict it.  XXX Not sure if this is necessary.  If
@@ -194,7 +194,7 @@
             raise
         else:
             # Add the object to the cache active list
-            self._cache.setstate(oid, obj)
+            self._cache.activate(oid)
 
     def _is_invalidated(self, obj):
         # Helper method for setstate() covers three cases:
@@ -262,14 +262,14 @@
             self._version = version
         self._inv_lock.acquire()
         try:
-            self._cache.invalidateMany(self._invalidated)
+            self._cache.invalidate(self._invalidated)
             self._invalidated.clear()
         finally:
             self._inv_lock.release()
         self._open = True
 
     def cacheGC(self):
-        self._cache.incrgc()
+        self._cache.shrink()
 
     def invalidate(self, oids):
         self._inv_lock.acquire()
@@ -285,7 +285,7 @@
             raise TransactionError(msg)
         self._log.debug("connection closed")
         self._open = False
-        self._cache.incrgc()
+        self._cache.shrink()
         # Return the connection to the pool.
         self._db._closeConnection(self)
 
@@ -321,11 +321,11 @@
         self._storage.tpcAbort(txn)
 
         if self._registered:
-            self._cache.invalidateMany([obj._p_oid
+            self._cache.invalidate([obj._p_oid
                                         for obj in self._registered])
             self._registered.clear()
         self._invalidate_created(self._created)
-        self._cache.invalidateMany(self._modified)
+        self._cache.invalidate(self._modified)
         self._txn = None
         self._flush_invalidations()
         self._created.clear()
@@ -365,7 +365,7 @@
 
         # The tpcFinish() of TmpStore returns an UndoInfo object.
         undo = self._storage.tpcFinish(txn)
-        self._cache.incrgc()
+        self._cache.shrink()
         self._storage._created = self._created
         self._created = Set()
         return Rollback(self, undo)
@@ -377,7 +377,7 @@
             if o is not None:
                 del o._p_jar
                 del o._p_oid
-                del self._cache[oid]
+                self._cache.remove(oid)
 
     def _invalidate_modified(self):
         self._db.invalidate(self._modified, self, self._version)
@@ -385,12 +385,12 @@
     def _flush_invalidations(self):
         self._inv_lock.acquire()
         try:
-            self._cache.invalidateMany(self._invalidated)
+            self._cache.invalidate(self._invalidated)
             self._invalidated.clear()
         finally:
             self._inv_lock.release()
         # Now is a good time to collect some garbage
-        self._cache.incrgc()
+        self._cache.shrink()
 
     def _handle_serial(self, store_return, oid=None, change=True):
         """Handle the returns from store() and tpc_vote() calls."""
@@ -415,7 +415,7 @@
         if isinstance(store_return, str):
             assert oid is not None
             serial = store_return
-            obj = self._cache.get(oid, None)
+            obj = self._cache.get(oid)
             if obj is None:
                 return
             if serial == ResolvedSerial:
@@ -428,7 +428,7 @@
             for oid, serial in store_return:
                 if not isinstance(serial, str):
                     raise serial
-                obj = self._cache.get(oid, None)
+                obj = self._cache.get(oid)
                 if obj is None:
                     continue
                 if serial == ResolvedSerial:
@@ -483,7 +483,7 @@
         # Put the object in the cache before handling the
         # response, just in case the response contains the
         # serial number for a newly created object
-        self._cache[oid] = obj
+        self._cache.set(oid, obj)
         self._handle_serial(s, oid)
 
     def _commit_sub(self, txn):
@@ -515,7 +515,7 @@
         self._storage = self._tmp
         self._tmp = None
 
-        self._cache.invalidateMany(tmp._index)
+        self._cache.invalidate(tmp._index)
         self._invalidate_created(tmp._created)
         tmp.close()
 
@@ -540,7 +540,7 @@
             msg = "savepoint has already been committed"
             raise interfaces.RollbackError(msg)
         self._tmp_undo.rollback()
-        self._conn._cache.invalidateMany(self._conn._modified)
+        self._conn._cache.invalidate(self._conn._modified)
 
 class UndoInfo:
     """A helper class for rollback.


=== Zope3/src/zodb/serialize.py 1.19 => 1.20 ===
--- Zope3/src/zodb/serialize.py:1.19	Tue Apr  1 15:22:04 2003
+++ Zope3/src/zodb/serialize.py	Wed Apr 16 18:06:20 2003
@@ -275,7 +275,7 @@
             obj._p_jar = self._conn
             obj._p_changed = None
 
-            self._cache[oid] = obj
+            self._cache.set(oid, obj)
             return obj
 
         obj = self._cache.get(oid)