Index: includes/menu.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/menu.inc,v
retrieving revision 1.215
diff -u -p -r1.215 menu.inc
--- includes/menu.inc	8 Oct 2007 18:49:03 -0000	1.215
+++ includes/menu.inc	10 Oct 2007 21:34:41 -0000
@@ -1559,7 +1559,8 @@ function menu_link_delete($mlid, $path =
 /**
  * Helper function for menu_link_delete; deletes a single menu link.
  */
-function _menu_delete_item($item, $rebuild = FALSE) {
+function _menu_delete_item($item) {
+  static $cache_cleared = 0;
   // System-created items are only deleted on menu rebuild.
   if ($item && ($item['module'] != 'system' || $rebuild)) {
 
@@ -1576,12 +1577,18 @@ function _menu_delete_item($item, $rebui
 
     // Update the has_children status of the parent.
     _menu_update_parental_status($item);
+    menu_cache_clear($item['menu_name']);
 
-    // If we are rebuilding the menu, the menu cache has already been cleared.
-    if (!$rebuild) {
-      menu_cache_clear($item['menu_name']);
-      // Clear the page and block caches.
-      cache_clear_all();
+    if ($cache_cleared < 2) {
+      // Clear the page and block caches, but at most twice, including at 
+      //  the end of the page load when there are multple links deleted.
+      if ($cache_cleared == 0) {
+        cache_clear_all();
+      }
+      else {
+        register_shutdown_function('cache_clear_all');
+      }
+      $cache_cleared++;
     }
   }
 }
@@ -1601,6 +1608,8 @@ function _menu_delete_item($item, $rebui
  *     router_path The path of the relevant router item.
  */
 function menu_link_save(&$item) {
+  static $cache_cleared = 0;
+
   $menu = menu_router_build();
 
   drupal_alter('menu_link', $item, $menu);
@@ -1726,8 +1735,18 @@ function menu_link_save(&$item) {
     $names[] = $n['menu_name'];
   }
   variable_set('menu_expanded', $names);
-  // Clear the page and block caches.
-  cache_clear_all();
+
+    if ($cache_cleared < 2) {
+      // Clear the page and block caches, but at most twice, including at 
+      //  the end of the page load when there are multple links saved.
+      if ($cache_cleared == 0) {
+        cache_clear_all();
+      }
+      else {
+        register_shutdown_function('cache_clear_all');
+      }
+      $cache_cleared++;
+    }
   return $item['mlid'];
 }
 
