Index: contributions/modules/memcache/memcache.inc
===================================================================
RCS file: /var/cvsroot/contributions/modules/memcache/memcache.inc,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 memcache.inc
--- sites/all/modules/memcache/memcache.inc	7 Oct 2007 03:12:06 -0000	1.1.1.1
+++ sites/all/modules/memcache/memcache.inc	31 Oct 2007 05:39:06 -0000
@@ -84,8 +89,13 @@ function cache_clear_all($cid = NULL, $t
   // 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 == '*') {
+  // use cache_page by default.
+  if (empty($cid)) {
+    /* don't do anything if cid is unset. this matches the default drupal behavior on clear_cache_all where only expired items are removed. cache_permanent and unexpired items remain. since memcache deals with expiry automatically, there's nothing to do here.
+    */
+  }
+  else if ($cid == '*' && $wildcard) {
     dmemcache_flush($table);
   }
   else {
