diff --git a/all/modules/memcache/dmemcache.inc b/all/modules/memcache/dmemcache.inc
index 6a68b14..0366e26 100755
--- a/all/modules/memcache/dmemcache.inc
+++ b/all/modules/memcache/dmemcache.inc
@@ -418,20 +418,33 @@ function dmemcache_object($bin = NULL, $flush = FALSE) {
 }
 
 function dmemcache_key($key = '', $bin = 'cache', $reset = FALSE) {
-  static $prefix;
-  if (!isset($prefix)) {
-    $prefix = '';
-    // memcache_key_prefix can be set in settings.php to support site namespaces
-    // in a multisite environment.
-    if ($prefix = variable_get('memcache_key_prefix', '')) {
-      $prefix .= '-';
-    }
-    // When simpletest is running, emulate the simpletest database prefix here
-    // to avoid the child site setting cache entries in the parent site.
-    if (isset($GLOBALS['drupal_test_info']['test_run_id'])) {
-      $prefix .= $GLOBALS['drupal_test_info']['test_run_id'];
+  static $prefixes;
+  $prefix = '';
+  if (!isset($prefixes)) {
+    // memcache_key_prefix can be set in settings.php to support site namespaces in a multisite environment.
+    $prefixes = variable_get('memcache_key_prefix', ''); 
+  }
+  
+  if (is_array($prefixes)) {
+    if (!empty($prefixes[$bin])) {
+      $prefix = $prefixes[$bin] . '-';
+    }// Support default prefix for site 
+    elseif (!empty($prefixes['default'])) {
+      $prefix = $prefixes['default'] . '-';
     }
+  } 
+  elseif (!empty($prefixes)) {
+    // Support single string prefix (Old behavior)
+    $prefix = $prefixes . '-';
   }
+  
+  // When simpletest is running, emulate the simpletest database prefix here
+  // to avoid the child site setting cache entries in the parent site.
+  if (isset($GLOBALS['drupal_test_info']['test_run_id'])) {
+    $prefix .= $GLOBALS['drupal_test_info']['test_run_id'];
+  } 
+
+
   $full_key = urlencode($prefix . $bin . '-' . $key);
 
   // Memcache only supports key lengths up to 250 bytes.  If we have generated
