[Erp5-report] r11998 - /erp5/trunk/products/ERP5Type/Cache.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Thu Jan 11 09:34:57 CET 2007
Author: ivan
Date: Thu Jan 11 09:34:49 2007
New Revision: 11998
URL: http://svn.erp5.org?rev=11998&view=rev
Log:
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.
Modified:
erp5/trunk/products/ERP5Type/Cache.py
Modified: erp5/trunk/products/ERP5Type/Cache.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Cache.py?rev=11998&r1=11997&r2=11998&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Cache.py (original)
+++ erp5/trunk/products/ERP5Type/Cache.py Thu Jan 11 09:34:49 2007
@@ -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'
@@ -189,7 +189,14 @@
## no caching enabled for this site or no such cache factory
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.
More information about the Erp5-report
mailing list