Index: memcache.db.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/memcache/memcache.db.inc,v
retrieving revision 1.2.2.7
diff -u -p -r1.2.2.7 memcache.db.inc
--- memcache.db.inc	30 Aug 2007 15:22:42 -0000	1.2.2.7
+++ memcache.db.inc	7 Nov 2007 12:23:05 -0000
@@ -167,18 +167,6 @@ function cache_set($cid, $table = 'cache
  */
 function cache_clear_all($cid = NULL, $table = NULL, $wildcard = FALSE) {
   global $user;
-
-  // Memcache logic is simpler because memcache doesn't have a minimum cache
-  // lifetime consideration (it handles it internally), and doesn't support
-  // wildcards.
-  $bin = empty($table) ? 'cache' : $table;
-  if (empty($cid) || $cid == '*') {
-    dmemcache_flush($table);
-  }
-  else {
-    dmemcache_delete($cid, $table);
-  }
-
   if (!isset($cid) && !isset($table)) {
     cache_clear_all(NULL, 'cache_page');
     return;
@@ -222,6 +210,18 @@ function cache_clear_all($cid = NULL, $t
       db_query("DELETE FROM {%s} WHERE cid = '%s'", $table, $cid);
     }
   }
+  // Memcache logic is simpler because memcache doesn't have a minimum cache
+  // lifetime consideration (it handles it internally), and doesn't support
+  // wildcards.
+  if (empty($table)) {
+    $table = 'cache';
+  }
+  if (empty($cid) || $cid == '*') {
+    dmemcache_flush($table);
+  }
+  else {
+    dmemcache_delete($cid, $table);
+  }
 }
 
 /**
