Commit 6df17404 authored by Vincent Pelletier's avatar Vincent Pelletier

Use a persistent sequence number to invalidate catalog cache.

Allows consistent invalidations in a cluster.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@39142 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 65a84202
......@@ -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):
"""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment