Commit 62986728 authored by Ivan Tyagov's avatar Ivan Tyagov

Forgotten import and explicit cache key delete functionalityso CachingMethod...

Forgotten import and explicit cache key delete functionalityso CachingMethod (with your own Cache Factory) can be used instead of portal_session tool as a global RAM storage.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@11998 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 08ce2e39
......@@ -29,7 +29,7 @@
import string
from time import time
from AccessControl.SecurityInfo import allow_class
from AccessControl import getSecurityManager
from CachePlugins.BaseCache import CachedMethodError
from zLOG import LOG
DEFAULT_CACHE_SCOPE = 'GLOBAL'
......@@ -190,6 +190,13 @@ class CachingMethod:
value = self.callable_object(*args, **kwd)
return value
def delete(self, id, cache_factory=DEFAULT_CACHE_FACTORY, scope=DEFAULT_CACHE_SCOPE):
""" Delete cache key. """
cache_id = self.generateCacheId(id)
cache_factory = CachingMethod.factories[cache_factory]
for cp in cache_factory.getCachePluginList():
cp.delete(cache_id, scope)
def generateCacheId(self, method_id, *args, **kwd):
""" Generate proper cache id based on *args and **kwd """
## generate cache id out of arguments passed.
......
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