[Zope-Checkins] CVS: Zope3/lib/python/Persistence - Cache.py:1.1.2.2

Jim Fulton jim@zope.com
Sun, 25 Nov 2001 19:20:09 -0500


Update of /cvs-repository/Zope3/lib/python/Persistence
In directory cvs.zope.org:/tmp/cvs-serv14527

Modified Files:
      Tag: Zope-3x-branch
	Cache.py 
Log Message:
Factored multiple and single cache invalidation

=== Zope3/lib/python/Persistence/Cache.py 1.1.2.1 => 1.1.2.2 ===
         self.__iter=None
 
-    def invalidate(self, oids):
-        if oids is None: oids=iter(self.__active)
+    def invalidate(self, oid):
+        ob=self.__aget(oid, self)
+        if ob is self: return
+        ob=ob()
+        del ob._p_changed
+        del self.__active[oid]
+        ghosts=self.__ghosts
+        ghosts[oid] = ref(ob, _dictdel(oid, ghosts))
+
+    def invalidateMany(self, oids):
+        if oids is None:
+            oids=self.__active.keys()
         aget=self.__aget
         active=self.__active
         ghosts=self.__ghosts