Commit dcba32b7 authored by Ivan Tyagov's avatar Ivan Tyagov

Added a method to clear all cache factories.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@13150 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 54195dbc
...@@ -174,9 +174,19 @@ class CacheTool(BaseTool): ...@@ -174,9 +174,19 @@ class CacheTool(BaseTool):
if REQUEST is not None: if REQUEST is not None:
self.REQUEST.RESPONSE.redirect('cache_tool_configure?manage_tabs_message=Cache updated.') self.REQUEST.RESPONSE.redirect('cache_tool_configure?manage_tabs_message=Cache updated.')
security.declareProtected(Permissions.ModifyPortalContent, 'clearAllCache')
def clearAllCache(self, REQUEST=None):
""" Clear all cache factories. """
ram_cache_root = self.getRamCacheRoot()
for cf_key in ram_cache_root.keys():
for cp in ram_cache_root[cf_key].getCachePluginList():
cp.clearCache()
if REQUEST is not None:
self.REQUEST.RESPONSE.redirect('cache_tool_configure?manage_tabs_message=All cache factories cleared.')
security.declareProtected(Permissions.ModifyPortalContent, 'clearCache') security.declareProtected(Permissions.ModifyPortalContent, 'clearCache')
def clearCache(self, cache_factory_list=(DEFAULT_CACHE_FACTORY,), REQUEST=None): def clearCache(self, cache_factory_list=(DEFAULT_CACHE_FACTORY,), REQUEST=None):
""" Clear cache factory. """ """ Clear specified or default cache factory. """
ram_cache_root = self.getRamCacheRoot() ram_cache_root = self.getRamCacheRoot()
for cf_key in cache_factory_list: for cf_key in cache_factory_list:
if ram_cache_root.has_key(cf_key): if ram_cache_root.has_key(cf_key):
......
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