From 6c18e27f775a278a7414c58700d69dd0270a78b3 Mon Sep 17 00:00:00 2001 From: Nicolas Delaby <nicolas@nexedi.com> Date: Mon, 14 Sep 2009 08:26:37 +0000 Subject: [PATCH] Base64 escaping format is better candidate than b2a_hex, because escaping value is lower sized. But it introduce some newlines which can be safely removed git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@29013 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5Type/CachePlugins/DistributedRamCache.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/product/ERP5Type/CachePlugins/DistributedRamCache.py b/product/ERP5Type/CachePlugins/DistributedRamCache.py index 44b9e1e458..e2e6806e2a 100644 --- a/product/ERP5Type/CachePlugins/DistributedRamCache.py +++ b/product/ERP5Type/CachePlugins/DistributedRamCache.py @@ -36,7 +36,7 @@ from BaseCache import BaseCache from BaseCache import CacheEntry from Products.ERP5Type import interfaces import zope.interface -from binascii import b2a_hex +from base64 import encodestring try: import memcache @@ -112,7 +112,7 @@ class DistributedRamCache(BaseCache): # Escape key to normalise some chars # which are not allowed by memcached # Could reach the limit of max_key_len - cache_id = b2a_hex(cache_id) + cache_id = encodestring(cache_id).replace('\n', '') return cache_id def get(self, cache_id, scope, default=_MARKER): -- 2.30.9