diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc index 1b7b52eb4d5..81598b5c9a0 100644 --- a/includes/bootstrap.inc +++ b/includes/bootstrap.inc @@ -701,12 +701,12 @@ function drupal_get_filename($type, $name, $filename = NULL) { */ function variable_initialize($conf = array()) { // NOTE: caching the variables improves performance by 20% when serving cached pages. - if ($cached = cache_get('variables', 'cache')) { + if ($cached = cache_get('variables', 'cache_bootstrap')) { $variables = $cached->data; } else { $variables = array_map('unserialize', db_query('SELECT name, value FROM {variable}')->fetchAllKeyed()); - cache_set('variables', $variables); + cache_set('variables', $variables, 'cache_bootstrap'); } foreach ($conf as $name => $value) { @@ -750,7 +750,7 @@ function variable_set($name, $value) { db_merge('variable')->key(array('name' => $name))->fields(array('value' => serialize($value)))->execute(); - cache_clear_all('variables', 'cache'); + cache_clear_all('variables', 'cache_bootstrap'); $conf[$name] = $value; } @@ -769,7 +769,7 @@ function variable_del($name) { db_delete('variable') ->condition('name', $name) ->execute(); - cache_clear_all('variables', 'cache'); + cache_clear_all('variables', 'cache_bootstrap'); unset($conf[$name]); } @@ -2005,7 +2005,7 @@ function _registry_check_code($type, $name = NULL) { if (!isset($lookup_cache)) { $lookup_cache = array(); - if ($cache = cache_get('lookup_cache', 'cache_registry')) { + if ($cache = cache_get('lookup_cache', 'cache_bootstrap')) { $lookup_cache = $cache->data; } } @@ -2022,7 +2022,7 @@ function _registry_check_code($type, $name = NULL) { // changes to the lookup cache for this request. if ($type == REGISTRY_WRITE_LOOKUP_CACHE) { if ($cache_update_needed) { - cache_set('lookup_cache', $lookup_cache, 'cache_registry'); + cache_set('lookup_cache', $lookup_cache, 'cache_bootstrap'); } return; } diff --git a/includes/cache.inc b/includes/cache.inc index 6069ce00416..8eb1573b36a 100644 --- a/includes/cache.inc +++ b/includes/cache.inc @@ -36,9 +36,10 @@ function _cache_get_object($bin) { * The cache ID of the data to retrieve. * @param $bin * The cache bin to store the data in. Valid core values are 'cache_block', - * 'cache_field', 'cache_filter', 'cache_form', 'cache_menu', 'cache_page', - * 'cache_path', 'cache_registry', 'cache_update' or 'cache' for the default - * cache. + * 'cache_bootstrap', 'cache_field', 'cache_filter', 'cache_form', + * 'cache_menu', 'cache_page', 'cache_path', 'cache_update' or 'cache' for + * the default cache. + * * @return The cache or FALSE on failure. */ function cache_get($cid, $bin = 'cache') { @@ -117,8 +118,8 @@ function cache_get_multiple(array &$cids, $bin = 'cache') { * Strings will be stored as plain text and not serialized. * @param $bin * The cache bin to store the data in. Valid core values are 'cache_block', - * 'cache_field', 'cache_filter', 'cache_form', 'cache_menu', 'cache_page', - * 'cache_path', 'cache_registry', 'cache_update' or 'cache' for the default + * 'cache_bootstrap', 'cache_field', 'cache_filter', 'cache_form', + * 'cache_menu', 'cache_page', 'cache_update' or 'cache' for the default * cache. * @param $expire * One of the following values: diff --git a/includes/common.inc b/includes/common.inc index 310bfebcdc1..6bce4c59903 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -6088,7 +6088,7 @@ function drupal_flush_all_caches() { node_types_rebuild(); // Don't clear cache_form - in-progress form submissions may break. // Ordered so clearing the page cache will always be the last action. - $core = array('cache', 'cache_filter', 'cache_registry', 'cache_page'); + $core = array('cache', 'cache_filter', 'cache_bootstrap', 'cache_page'); $cache_tables = array_merge(module_invoke_all('flush_caches'), $core); foreach ($cache_tables as $table) { cache_clear_all('*', $table, TRUE); diff --git a/includes/module.inc b/includes/module.inc index 6294bda8e42..2bb2ce316ac 100644 --- a/includes/module.inc +++ b/includes/module.inc @@ -438,16 +438,16 @@ function module_implements($hook, $sort = FALSE, $reset = FALSE) { // per request. if ($reset) { $implementations = array(); - cache_set('module_implements', array()); + cache_set('module_implements', array(), 'cache_bootstrap'); drupal_static_reset('module_hook_info'); drupal_static_reset('drupal_alter'); - cache_clear_all('hook_info', 'cache'); + cache_clear_all('hook_info', 'cache_bootstrap'); return; } // Fetch implementations from cache. if (empty($implementations)) { - $implementations = cache_get('module_implements'); + $implementations = cache_get('module_implements', 'cache_bootstrap'); if ($implementations === FALSE) { $implementations = array(); } @@ -498,7 +498,7 @@ function module_hook_info() { $hook_info = &drupal_static(__FUNCTION__, array()); if (empty($hook_info)) { - $cache = cache_get('hook_info'); + $cache = cache_get('hook_info', 'cache_bootstrap'); if ($cache === FALSE) { // Rebuild the cache and save it. // We can't use module_invoke_all() here or it would cause an infinite @@ -519,7 +519,7 @@ function module_hook_info() { $function($hook_info); } } - cache_set('hook_info', $hook_info); + cache_set('hook_info', $hook_info, 'cache_bootstrap'); } else { $hook_info = $cache->data; diff --git a/includes/registry.inc b/includes/registry.inc index 2bc98e0b16e..be715485197 100644 --- a/includes/registry.inc +++ b/includes/registry.inc @@ -83,7 +83,7 @@ function _registry_rebuild() { $unchanged_resources = array(); $lookup_cache = array(); - if ($cache = cache_get('lookup_cache', 'cache_registry')) { + if ($cache = cache_get('lookup_cache', 'cache_bootstrap')) { $lookup_cache = $cache->data; } foreach ($lookup_cache as $key => $file) { @@ -96,12 +96,10 @@ function _registry_rebuild() { module_implements('', FALSE, TRUE); _registry_check_code(REGISTRY_RESET_LOOKUP_CACHE); - cache_clear_all('*', 'cache_registry', TRUE); - // We have some unchanged resources, warm up the cache - no need to pay // for looking them up again. if (count($unchanged_resources) > 0) { - cache_set('lookup_cache', $unchanged_resources, 'cache_registry'); + cache_set('lookup_cache', $unchanged_resources, 'cache_bootstrap'); } } diff --git a/includes/update.inc b/includes/update.inc index 344d250fe99..64353023b17 100644 --- a/includes/update.inc +++ b/includes/update.inc @@ -286,6 +286,10 @@ function update_fix_d7_requirements() { db_create_table('date_formats', $schema['date_formats']); db_create_table('date_format_locale', $schema['date_format_locale']); + $schema['cache_bootstrap'] = $schema['cache']; + $schema['cache_bootstrap']['description'] = 'Cache table for data required to bootstrap Drupal, may be routed to a shared memory cache.'; + db_create_table('cache_bootstrap', $schema['cache_bootstrap']); + // Add column for locale context. if (db_table_exists('locales_source')) { db_add_field('locales_source', 'context', array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => '', 'description' => 'The context this string applies to.')); diff --git a/modules/simpletest/drupal_web_test_case.php b/modules/simpletest/drupal_web_test_case.php index 9b0bf727546..98f4445ba60 100644 --- a/modules/simpletest/drupal_web_test_case.php +++ b/modules/simpletest/drupal_web_test_case.php @@ -1149,7 +1149,7 @@ class DrupalWebTestCase extends DrupalTestCase { */ protected function refreshVariables() { global $conf; - cache_clear_all('variables', 'cache'); + cache_clear_all('variables', 'cache_bootstrap'); $conf = variable_initialize(); } diff --git a/modules/system/system.install b/modules/system/system.install index 6c3f1b40637..412d116b1fc 100644 --- a/modules/system/system.install +++ b/modules/system/system.install @@ -701,6 +701,8 @@ function system_schema() { 'primary key' => array('cid'), ); + $schema['cache_bootstrap'] = $schema['cache']; + $schema['cache_bootstrap']['description'] = 'Cache table for data required to bootstrap Drupal, may be routed to a shared memory cache.'; $schema['cache_form'] = $schema['cache']; $schema['cache_form']['description'] = 'Cache table for the form system to store recently built forms and their storage data, to be used in subsequent page requests.'; $schema['cache_page'] = $schema['cache']; @@ -709,8 +711,6 @@ function system_schema() { $schema['cache_menu']['description'] = 'Cache table for the menu system to store router information as well as generated link trees for various menu/page/user combinations.'; $schema['cache_path'] = $schema['cache']; $schema['cache_path']['description'] = 'Cache table for path alias lookup.'; - $schema['cache_registry'] = $schema['cache']; - $schema['cache_registry']['description'] = 'Cache table for the code registry system to remember what code files need to be loaded on any given page.'; $schema['date_format_type'] = array( 'description' => 'Stores configured date format types.', @@ -1962,19 +1962,6 @@ function system_update_7006() { ), 'primary key' => array('filename'), ); - $schema['cache_registry'] = array( - 'fields' => array( - 'cid' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''), - 'data' => array('type' => 'blob', 'not null' => FALSE, 'size' => 'big'), - 'expire' => array('type' => 'int', 'not null' => TRUE, 'default' => 0), - 'created' => array('type' => 'int', 'not null' => TRUE, 'default' => 0), - 'headers' => array('type' => 'text', 'not null' => FALSE), - 'serialized' => array('type' => 'int', 'size' => 'small', 'not null' => TRUE, 'default' => 0) - ), - 'indexes' => array('expire' => array('expire')), - 'primary key' => array('cid'), - ); - db_create_table('cache_registry', $schema['cache_registry']); db_create_table('registry', $schema['registry']); db_create_table('registry_file', $schema['registry_file']); registry_rebuild();