Index: dmemcache.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/memcache/dmemcache.inc,v
retrieving revision 1.1.2.7.2.7
diff -u -F '^f' -r1.1.2.7.2.7 dmemcache.inc
--- dmemcache.inc	5 Dec 2009 00:23:12 -0000	1.1.2.7.2.7
+++ dmemcache.inc	3 Apr 2010 03:53:28 -0000
@@ -236,8 +236,13 @@ function dmemcache_key($key, $bin = 'cac
   // in a multisite environment.
   if (empty($prefix)) {
     $prefix = variable_get('memcache_key_prefix', '');
+    if ($prefix) {
+      $prefix .= '-';
+    }
   }
-  $full_key = ($prefix ? $prefix. '-' : '') . $bin . '-' . $key;
 
-  return urlencode($full_key);
+  // Use an md5 hash, so we are within the 250 byte limit of memcached,
+  // otherwise, long URL aliases and unicode conspire against us and 
+  // we get name clashes
+  return md5($prefix . $bin . '-' . $key);
 }
