diff options
author | Dries Buytaert <dries@buytaert.net> | 2009-11-10 22:06:09 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2009-11-10 22:06:09 +0000 |
commit | 3ccb55f2bd99a008577214296c17d2cf060874b5 (patch) | |
tree | dd65e92d7a254d5e5d9fff5e05b5d0da496a797f /includes | |
parent | 0629cfa95750270261f429880cb98974f790aa41 (diff) | |
download | brdo-3ccb55f2bd99a008577214296c17d2cf060874b5.tar.gz brdo-3ccb55f2bd99a008577214296c17d2cf060874b5.tar.bz2 |
- Patch #627338 by catch: add a cache_bootstrap() bin for better performance/scalability.
Diffstat (limited to 'includes')
-rw-r--r-- | includes/bootstrap.inc | 12 | ||||
-rw-r--r-- | includes/cache.inc | 11 | ||||
-rw-r--r-- | includes/common.inc | 2 | ||||
-rw-r--r-- | includes/module.inc | 10 | ||||
-rw-r--r-- | includes/registry.inc | 6 | ||||
-rw-r--r-- | includes/update.inc | 4 |
6 files changed, 24 insertions, 21 deletions
diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc index 1b7b52eb4..81598b5c9 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 6069ce004..8eb1573b3 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 310bfebcd..6bce4c599 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 6294bda8e..2bb2ce316 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 2bc98e0b1..be7154851 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 344d250fe..64353023b 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.')); |