[Erp5-report] r39142 vincent - /erp5/trunk/products/ZSQLCatalog/SQLCatalog.py

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Oct 14 14:50:25 CEST 2010


Author: vincent
Date: Thu Oct 14 14:50:23 2010
New Revision: 39142

URL: http://svn.erp5.org?rev=39142&view=rev
Log:
Use a persistent sequence number to invalidate catalog cache.

Allows consistent invalidations in a cluster.

Modified:
    erp5/trunk/products/ZSQLCatalog/SQLCatalog.py

Modified: erp5/trunk/products/ZSQLCatalog/SQLCatalog.py
URL: http://svn.erp5.org/erp5/trunk/products/ZSQLCatalog/SQLCatalog.py?rev=39142&r1=39141&r2=39142&view=diff
==============================================================================
--- erp5/trunk/products/ZSQLCatalog/SQLCatalog.py [utf8] (original)
+++ erp5/trunk/products/ZSQLCatalog/SQLCatalog.py [utf8] Thu Oct 14 14:50:23 2010
@@ -122,6 +122,7 @@ class transactional_cache_decorator:
     def wrapper(wrapped_self):
       transactional_cache = getTransactionalVariable()
       cache_id = str((self.cache_id,
+        wrapped_self.getCacheSequenceNumber(),
         getInstanceID(wrapped_self),
       ))
       try:
@@ -596,6 +597,8 @@ class Catalog(Folder,
   manage_catalogFind = DTMLFile('dtml/catalogFind',globals())
   manage_catalogAdvanced = DTMLFile('dtml/catalogAdvanced', globals())
 
+  _cache_sequence_number = 0
+
   def __init__(self, id, title='', container=None):
     if container is not None:
       self=self.__of__(container)
@@ -606,6 +609,12 @@ class Catalog(Folder,
     self.indexes = {}   # empty mapping
     self.filter_dict = PersistentMapping()
 
+  def getCacheSequenceNumber(self):
+    return self._cache_sequence_number
+
+  def _clearCaches(self):
+    self._cache_sequence_number += 1
+
   def getSQLCatalogRoleKeysList(self):
     """
     Return the list of role keys.
@@ -840,6 +849,7 @@ class Catalog(Folder,
       self.insertMaxUid()
 
     self._clearSecurityCache()
+    self._clearCaches()
 
   def insertMaxUid(self):
     """




More information about the Erp5-report mailing list