[Erp5-report] r28023 - /erp5/trunk/products/ERP5Type/CachePlugins/DistributedRamCache.py

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Jul 8 14:51:26 CEST 2009


Author: nicolas
Date: Wed Jul  8 14:51:24 2009
New Revision: 28023

URL: http://svn.erp5.org?rev=28023&view=rev
Log:
Add additional parameter to prefix keys

Modified:
    erp5/trunk/products/ERP5Type/CachePlugins/DistributedRamCache.py

Modified: erp5/trunk/products/ERP5Type/CachePlugins/DistributedRamCache.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/CachePlugins/DistributedRamCache.py?rev=28023&r1=28022&r2=28023&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/CachePlugins/DistributedRamCache.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/CachePlugins/DistributedRamCache.py [utf8] Wed Jul  8 14:51:24 2009
@@ -59,6 +59,7 @@
     self._server_max_key_length = params.get('server_max_key_length', 250)
     self._server_max_value_length = params.get('server_max_value_length', 1024*1024)
     self._debug_level = params.get('debug_level', 0)
+    self._key_prefix = params.get('key_prefix', '')
     BaseCache.__init__(self)
 
   def initCacheStorage(self):
@@ -90,7 +91,7 @@
   def checkAndFixCacheId(self, cache_id, scope):
     ## memcached doesn't support namespaces (cache scopes) so to "emmulate"
     ## such behaviour when constructing cache_id we add scope in front
-    cache_id = "%s.%s" %(scope, cache_id)
+    cache_id = "%s%s.%s" % (self._key_prefix, scope, cache_id)
     if self._server_max_key_length != 0:
       ## memcached will fail to store cache_id longer than MEMCACHED_SERVER_MAX_KEY_LENGTH.
       return cache_id[:self._server_max_key_length]




More information about the Erp5-report mailing list