[Zope3-checkins] CVS: Zope/lib/python/ZODB - Connection.py:1.132

Jeremy Hylton jeremy at zope.com
Tue Mar 2 10:43:17 EST 2004


Update of /cvs-repository/Zope/lib/python/ZODB
In directory cvs.zope.org:/tmp/cvs-serv4431/lib/python/ZODB

Modified Files:
	Connection.py 
Log Message:
Remove _incrgc attribute of Connection.
Add docstrings for public cache methods.


=== Zope/lib/python/ZODB/Connection.py 1.131 => 1.132 ===
--- Zope/lib/python/ZODB/Connection.py:1.131	Mon Mar  1 14:07:25 2004
+++ Zope/lib/python/ZODB/Connection.py	Tue Mar  2 10:43:16 2004
@@ -146,7 +146,6 @@
             # XXX Why do we want version caches to behave this way?
 
             self._cache.cache_drain_resistance = 100
-        self._incrgc = self.cacheGC = cache.incrgc
         self._committed = []
         self._added = {}
         self._reset_counter = global_reset_counter
@@ -348,7 +347,6 @@
         self._invalidated.clear()
         cache_size = self._cache.cache_size
         self._cache = cache = PickleCache(self, cache_size)
-        self._incrgc = self.cacheGC = cache.incrgc
 
     def abort(self, object, transaction):
         """Abort the object in the transaction.
@@ -380,12 +378,28 @@
         self._cache.full_sweep(dt)
 
     def cacheMinimize(self, dt=None):
-        # XXX needs doc string
+        """Deactivate all unmodified objects in the cache.
+
+        Call _p_deactivate() on each cached object, attempting to turn
+        it into a ghost.  It is possible for individual objects to
+        remain active.
+
+        @param dt: The dt argument is provided only for backwards
+            compatibility.  It is ignored.
+        """
         if dt is not None:
             warnings.warn("The dt argument to cacheMinimize is ignored.",
                           DeprecationWarning)
         self._cache.minimize()
 
+    def cacheGC(self):
+        """Reduce cache size to target size.
+        
+        Call _p_deactivate() on cached objects until the cache size
+        falls under the target size.
+        """
+        self._cache.incrgc()
+
     __onCloseCallbacks = None
 
     def onCloseCallback(self, f):
@@ -410,8 +424,8 @@
         L{onCloseCallback} are invoked and the cache is scanned for
         old objects.
         """
-        if self._incrgc is not None:
-            self._incrgc() # This is a good time to do some GC
+        if self._cache is not None:
+            self._cache.incrgc() # This is a good time to do some GC
 
         # Call the close callbacks.
         if self.__onCloseCallbacks is not None:




More information about the Zope3-Checkins mailing list