[Zodb-checkins] CVS: ZODB4/Persistence - Cache.py:1.6 interfaces.py:1.2 ICache.py:NONE

Jeremy Hylton jeremy@zope.com
Fri, 20 Dec 2002 14:13:42 -0500


Update of /cvs-repository/ZODB4/Persistence
In directory cvs.zope.org:/tmp/cvs-serv8997

Modified Files:
	Cache.py interfaces.py 
Removed Files:
	ICache.py 
Log Message:
Move ICache into interfaces.

Add declaration to Cache that it implements ICache.


=== ZODB4/Persistence/Cache.py 1.5 => 1.6 ===
--- ZODB4/Persistence/Cache.py:1.5	Fri Dec 13 17:12:38 2002
+++ ZODB4/Persistence/Cache.py	Fri Dec 20 14:13:40 2002
@@ -15,7 +15,11 @@
 from sys import getrefcount
 from weakref import ref
 
+from Persistence.interfaces import ICache
+
 class Cache(object):
+
+    __implements__ = ICache
 
     __iter=None
 


=== ZODB4/Persistence/interfaces.py 1.1 => 1.2 ===
--- ZODB4/Persistence/interfaces.py:1.1	Fri Dec 20 14:00:55 2002
+++ ZODB4/Persistence/interfaces.py	Fri Dec 20 14:13:40 2002
@@ -239,3 +239,71 @@
         The modification time may not be known, in which case None
         is returned.
         """
+        
+class ICache(Interface):
+    """In-memory object cache
+
+    Cache objects are used by data managers to implement in-memory
+    object caches with automatic object deactivation and removal of
+    unreferenced objects.
+
+    Cache objects depend heavily on the Persistent object C API.
+    """
+
+    def __getitem__(key):
+        """Get a cached object
+        """
+
+    def __setitem__(key, value):
+        """Add an object to the cache
+        """
+
+    def __len__():
+        """Return the number of objects in the cache
+        """
+
+    def get(oid, default=None):
+        """Get a cached object
+        """
+
+    def incrgc(multiple=1):
+        """Perform incremental garbage collection
+
+        An positive integer argument can be provided to speify a
+        number of incremental steps to take.
+        """
+
+    def full_sweep():
+        """Perform a full sweep of the cache
+        """
+
+    def minimize():
+        """Remove as many objects as possible from the cache
+        """
+
+    def invalidate(oids):
+        """Invalidate the object for the given object ids
+        """
+
+    def invalidateMany(oids):
+        """Invalidate the objects for the given colection of object ids
+
+        If oids is None, all of the objets in the cache are
+        invalidated.
+
+        The collection must be iterable as if it was a sequence of oids.
+        """
+
+class ICachePolicy(Interface):
+
+    def maximum_quiet(cache_size):
+        """Return a number of seconds
+
+        Objects that haven't been accessed in the last number seconds
+        should be deactivated.
+        """
+
+    def incremental_check_count(cache_size):
+        """Return the number of objects that should be checked in an
+        incremental garbage collection.
+        """

=== Removed File ZODB4/Persistence/ICache.py ===