diff --git a/product/ERP5Type/CachePlugins/DistributedRamCache.py b/product/ERP5Type/CachePlugins/DistributedRamCache.py
index 44b9e1e4585337322b8b7712849bdfefd94b493e..e2e6806e2afd757ce6c743ef455cd054f071e49e 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):