Commit b75ea10d authored by Nicolas Delaby's avatar Nicolas Delaby

Move hooks from MemcachedTool to MemcachePlugin to reset memcached_dict_pool at right time

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@27980 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 83f769e4
......@@ -34,6 +34,7 @@ from Products.ERP5.PropertySheet.SortIndex import SortIndex
from Products.ERP5.PropertySheet.Url import Url
from Products.ERP5Type.PropertySheet.MemcachedPlugin import MemcachedPlugin
from Products.ERP5Type import Permissions
from Products.ERP5Type.Tool.MemcachedTool import memcached_dict_pool
class MemcachedPlugin(XMLObject):
"""Memcached Plugin authorise Memcached Tool to connect several backends.
......@@ -60,3 +61,17 @@ class MemcachedPlugin(XMLObject):
, SortIndex
, Url
)
def manage_beforeDelete(self, *args, **kw):
try:
del(memcached_dict_pool.memcached_dict)
except AttributeError:
pass
XMLObject.manage_beforeDelete(self, *args, **kw)
def manage_afterAdd(self, *args, **kw):
try:
del(memcached_dict_pool.memcached_dict)
except AttributeError:
pass
XMLObject.manage_afterAdd(self, *args, **kw)
......@@ -303,19 +303,6 @@ if memcache is not None:
"""
return SharedDict(self._getMemcachedDict(plugin_path), prefix=key_prefix)
def manage_beforeDelete(self, *args, **kw):
try:
del(memcached_dict_pool.memcached_dict)
except AttributeError:
pass
BaseTool.manage_beforeDelete(self, *args, **kw)
def manage_afterAdd(self, *args, **kw):
try:
del(memcached_dict_pool.memcached_dict)
except AttributeError:
pass
BaseTool.manage_afterAdd(self, *args, **kw)
else:
# Placeholder memcache tool
class MemcachedTool(BaseTool):
......
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