Index: includes/menu.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/menu.inc,v retrieving revision 1.255.2.9 diff -u -p -r1.255.2.9 menu.inc --- includes/menu.inc 27 Feb 2008 12:12:01 -0000 1.255.2.9 +++ includes/menu.inc 9 Mar 2008 20:43:56 -0000 @@ -770,6 +770,7 @@ function menu_tree_output($tree) { function menu_tree_all_data($menu_name = 'navigation', $item = NULL) { static $tree = array(); + $use_cache = variable_get('menu_use_cache', FALSE); // Use $mlid as a flag for whether the data being loaded is for the whole tree. $mlid = isset($item['mlid']) ? $item['mlid'] : 0; // Generate the cache ID. @@ -777,7 +778,7 @@ function menu_tree_all_data($menu_name = if (!isset($tree[$cid])) { // If the static variable doesn't have the data, check {cache_menu}. - $cache = cache_get($cid, 'cache_menu'); + $cache = $use_cache ? cache_get($cid, 'cache_menu') : FALSE; if ($cache && isset($cache->data)) { $data = $cache->data; } @@ -814,7 +815,9 @@ function menu_tree_all_data($menu_name = $data['node_links'] = array(); menu_tree_collect_node_links($data['tree'], $data['node_links']); // Cache the data. - cache_set($cid, $data, 'cache_menu'); + if ($use_cache) { + cache_set($cid, $data, 'cache_menu'); + } } // Check access for the current user to each item in the tree. menu_tree_check_access($data['tree'], $data['node_links']); @@ -842,6 +845,7 @@ function menu_tree_all_data($menu_name = function menu_tree_page_data($menu_name = 'navigation') { static $tree = array(); + $use_cache = variable_get('menu_use_cache', FALSE); // Load the menu item corresponding to the current page. if ($item = menu_get_item()) { // Generate the cache ID. @@ -849,7 +853,7 @@ function menu_tree_page_data($menu_name if (!isset($tree[$cid])) { // If the static variable doesn't have the data, check {cache_menu}. - $cache = cache_get($cid, 'cache_menu'); + $cache = $use_cache ? cache_get($cid, 'cache_menu') : FALSE; if ($cache && isset($cache->data)) { $data = $cache->data; } @@ -910,7 +914,9 @@ function menu_tree_page_data($menu_name $data['node_links'] = array(); menu_tree_collect_node_links($data['tree'], $data['node_links']); // Cache the data. - cache_set($cid, $data, 'cache_menu'); + if ($use_cache) { + cache_set($cid, $data, 'cache_menu'); + } } // Check access for the current user to each item in the tree. menu_tree_check_access($data['tree'], $data['node_links']); Index: modules/system/system.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.admin.inc,v retrieving revision 1.63 diff -u -p -r1.63 system.admin.inc --- modules/system/system.admin.inc 4 Feb 2008 12:35:48 -0000 1.63 +++ modules/system/system.admin.inc 9 Mar 2008 20:43:56 -0000 @@ -1294,6 +1294,18 @@ function system_performance_settings() { '#description' => t("By default, Drupal compresses the pages it caches in order to save bandwidth and improve download times. This option should be disabled when using a webserver that performs compression."), ); + $form['menu_cache'] = array( + '#type' => 'fieldset', + '#title' => t('Menu cache'), + '#description' => t('Enabling the menu cache may offer a performance boost for all users, but this cache may require excessive amounts of database space for large sites. If enabled, Drupal does not have to construct the menu links data each time a page is viewed.'), + ); + $form['menu_cache']['menu_use_cache'] = array( + '#type' => 'radios', + '#title' => t('Menu caching mode'), + '#default_value' => variable_get('menu_use_cache', 0), + '#options' => array(t('Disabled'), t('Enabled (suitable for smaller sites only)')), + ); + $form['block_cache'] = array( '#type' => 'fieldset', '#title' => t('Block cache'),