Commit af7ccf6f authored by Nicolas Delaby's avatar Nicolas Delaby

Add new parameter to initialiaze memcached Client

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@27579 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent b4c7b6cc
...@@ -40,12 +40,6 @@ from Products.ERP5Type.Cache import DEFAULT_CACHE_FACTORY ...@@ -40,12 +40,6 @@ from Products.ERP5Type.Cache import DEFAULT_CACHE_FACTORY
from Products.ERP5Type.CachePlugins.RamCache import RamCache from Products.ERP5Type.CachePlugins.RamCache import RamCache
from Products.ERP5Type.CachePlugins.DistributedRamCache import DistributedRamCache from Products.ERP5Type.CachePlugins.DistributedRamCache import DistributedRamCache
## try to import needed modules for cache plugins
try:
import memcache
except ImportError:
memcache = None
class CacheTool(BaseTool): class CacheTool(BaseTool):
""" Caches tool wrapper for ERP5 """ """ Caches tool wrapper for ERP5 """
...@@ -88,14 +82,14 @@ class CacheTool(BaseTool): ...@@ -88,14 +82,14 @@ class CacheTool(BaseTool):
elif cp_meta_type == 'ERP5 Distributed Ram Cache': elif cp_meta_type == 'ERP5 Distributed Ram Cache':
## even thougn we have such plugin in ZODB that doens't mean ## even thougn we have such plugin in ZODB that doens't mean
## we have corresponding memcache module installed ## we have corresponding memcache module installed
if memcache is not None or cp.getSpecialiseValue() is not None: memcached_plugin = cp.getSpecialiseValue()
try: if memcached_plugin is not None:
cache_obj = DistributedRamCache( init_dict = {
{'server':cp.getSpecialiseValue().getUrlString()}) 'server': memcached_plugin.getUrlString(),
except AttributeError: 'server_max_key_length': memcached_plugin.getServerMaxKeyLength(),
# BACKWARD COMPATIBILITY 'server_max_value_length': memcached_plugin.getServerMaxValueLength(),
cache_obj = DistributedRamCache( }
{'server':getattr(cp, 'server', '')}) cache_obj = DistributedRamCache(init_dict)
else: else:
## we don't have memcache python module installed ## we don't have memcache python module installed
## thus we can't use DistributedRamCache plugin ## thus we can't use DistributedRamCache plugin
......
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