diff -u b/includes/cache.inc b/includes/cache.inc --- b/includes/cache.inc +++ b/includes/cache.inc @@ -336,6 +336,9 @@ */ function getMultiple(&$cids) { try { + // Garbage collection necessary when enforcing a minimum cache lifetime. + $this->garbageCollection($this->bin); + // When serving cached pages, the overhead of using db_select() was found // to add around 30% overhead to the request. Since $this->bin is a // variable, this means the call to db_query() here uses a concatenated @@ -343,9 +346,6 @@ */ function getMultiple(&$cids) { try { - // Garbage collection necessary when enforcing a minimum cache lifetime. - $this->garbageCollection($this->bin); - // When serving cached pages, the overhead of using db_select() was found // to add around 30% overhead to the request. Since $this->bin is a // variable, this means the call to db_query() here uses a concatenated diff -u b/modules/system/system.install b/modules/system/system.install --- b/modules/system/system.install +++ b/modules/system/system.install @@ -712,7 +712,7 @@ ), ), 'indexes' => array( - 'expire_created' => array('expire', 'created'), + 'expire' => array('expire'), ), 'primary key' => array('cid'), ); @@ -790,7 +790,7 @@ ), ), 'indexes' => array( - 'expire' => array('expire'), + 'expire_created' => array('expire', 'created'), ), 'primary key' => array('cid'), ); @@ -3193,23 +3193,6 @@ } /** - * Update all cache tables to use expire and created for their indexes. - */ -function system_update_7081() { - // Find all potential cache tables. - $tables = db_find_tables(Database::getConnection()->prefixTables('{cache}') . '%'); - - foreach ($tables as $table) { - // Assume a valid cache table if both 'cid' and 'data' columns exist. - if (db_field_exists($table, 'cid') && db_field_exists($table, 'data')) { - if (db_drop_index($table, 'expire')) { - db_add_index($table, 'expire_created', array('expire', 'created')); - } - } - } -} - -/** * @} End of "defgroup updates-7.x-extra". * The next series of updates should start at 8000. */ @@ -3303,6 +3286,23 @@ } /** + * Update all cache tables to use expire and created for their indexes. + */ +function system_update_7082() { + // Find all potential cache tables. + $tables = db_find_tables(Database::getConnection()->prefixTables('{cache}') . '%'); + + foreach ($tables as $table) { + // Assume a valid cache table if both 'cid' and 'data' columns exist. + if (db_field_exists($table, 'cid') && db_field_exists($table, 'data')) { + if (db_drop_index($table, 'expire')) { + db_add_index($table, 'expire_created', array('expire', 'created')); + } + } + } +} + +/** * @} End of "defgroup updates-7.x-extra". * The next series of updates should start at 8000. */ diff -u b/modules/system/system.module b/modules/system/system.module --- b/modules/system/system.module +++ b/modules/system/system.module @@ -3071,15 +3071,7 @@ $cache_tables = $cache_object->data; } foreach ($cache_tables as $table) { - // Expire all temporary and expired cache items. Limit this to once every 24 - // hours by default to avoid wiping page and block caches every cron run. - $cache = _cache_get_object($table); - $name = 'cache_garbage_collect_' . $table; - $window = max(variable_get('cache_lifetime', 0), variable_get('cache_garbage_collection_frequency', 86400)); - if (flood_is_allowed($name, 1, $window, 'cron')) { - flood_register_event($name, $window, 'cron'); - $cache->clear(); - } + cache_clear_all(NULL, $table); } // Cleanup the batch table and the queue for failed batches. @@ -3101,7 +3093,15 @@ $cache_tables = $cache_object->data; } foreach ($cache_tables as $table) { - cache_clear_all(NULL, $table); + // Expire all temporary and expired cache items. Limit this to once every 24 + // hours by default to avoid wiping page and block caches every cron run. + $cache = _cache_get_object($table); + $name = 'cache_garbage_collect_' . $table; + $window = max(variable_get('cache_lifetime', 0), variable_get('cache_garbage_collection_frequency', 86400)); + if (flood_is_allowed($name, 1, $window, 'cron')) { + flood_register_event($name, $window, 'cron'); + $cache->clear(); + } } // Cleanup the batch table and the queue for failed batches.