From c99f461d37aaedee0e3a31f6fcf03d29cc2a7ede Mon Sep 17 00:00:00 2001 From: catch <catch@35733.no-reply.drupal.org> Date: Tue, 27 Nov 2012 20:44:05 +0000 Subject: [PATCH] Issue #1848968 by Berdir: Fixed Too many checksum tag queries executed by the cache backend. --- core/lib/Drupal/Core/Cache/DatabaseBackend.php | 1 + core/lib/Drupal/Core/Config/CachedStorage.php | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/core/lib/Drupal/Core/Cache/DatabaseBackend.php b/core/lib/Drupal/Core/Cache/DatabaseBackend.php index a12ed1363305..0a1eec21d34f 100644 --- a/core/lib/Drupal/Core/Cache/DatabaseBackend.php +++ b/core/lib/Drupal/Core/Cache/DatabaseBackend.php @@ -272,6 +272,7 @@ protected function checksumTags($tags) { $query_tags[] = $tag; } } + if ($query_tags) { try { if ($db_tags = Database::getConnection()->query('SELECT tag, invalidations FROM {cache_tags} WHERE tag IN (:tags)', array(':tags' => $query_tags))->fetchAllKeyed()) { diff --git a/core/lib/Drupal/Core/Config/CachedStorage.php b/core/lib/Drupal/Core/Config/CachedStorage.php index ccbc4c98545d..35492cb7b751 100644 --- a/core/lib/Drupal/Core/Config/CachedStorage.php +++ b/core/lib/Drupal/Core/Config/CachedStorage.php @@ -69,7 +69,7 @@ public function read($name) { // Read from the storage on a cache miss and cache the data, if any. $data = $this->storage->read($name); if ($data !== FALSE) { - $this->cache->set($name, $data, CacheBackendInterface::CACHE_PERMANENT, array('config' => array($name))); + $this->cache->set($name, $data, CacheBackendInterface::CACHE_PERMANENT); } // If the cache contained bogus data and there is no data in the storage, // wipe the cache entry. @@ -86,7 +86,7 @@ public function write($name, array $data) { if ($this->storage->write($name, $data)) { // While not all written data is read back, setting the cache instead of // just deleting it avoids cache rebuild stampedes. - $this->cache->set($name, $data, CacheBackendInterface::CACHE_PERMANENT, array('config' => array($name))); + $this->cache->set($name, $data, CacheBackendInterface::CACHE_PERMANENT); return TRUE; } return FALSE; -- GitLab