﻿--- dmemcache.inc.orig  2010-09-29 17:04:05.000000000 +0200
+++ dmemcache.inc       2010-11-25 17:32:24.000000000 +0100
@@ -244,6 +244,10 @@ function dmemcache_object($bin = NULL, $

   if ($flush) {
     foreach ($memcacheCache as $cluster) {
+      if ($bin=='flush') {
+       $cluster->flush();
+      }
+
       $cluster->close();
     }
     $memcacheCache = array();
@@ -336,21 +340,15 @@ function dmemcache_object($bin = NULL, $

 function dmemcache_key($key, $bin = 'cache') {
   static $prefix;
+
   // memcache_key_prefix can be set in settings.php to support site namespaces
   // in a multisite environment.
-  if (empty($prefix)) {
+  if (!isset($prefix)) {
     if ($prefix = variable_get('memcache_key_prefix', '')) {
       $prefix .= '-';
     }
   }
-  $full_key = urlencode($prefix . $bin . '-' . $key);
-
-  // Memcache only supports key lengths up to 250 bytes.  If we have generated
-  // a longer key, hash it with sha1 which will shrink the key down to 40 bytes
-  // while still keeping it unique.
-  if (strlen($full_key) > 250) {
-    $full_key = $prefix . $bin . '-' . sha1($key);
-  }
+  $full_key = $prefix . $bin . '-' . hash('md4', $key);

   return $full_key;
 }
