Skip to content
Snippets Groups Projects
Commit c99f461d authored by catch's avatar catch
Browse files

Issue #1848968 by Berdir: Fixed Too many checksum tag queries executed by the cache backend.

parent 9318aa16
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
...@@ -272,6 +272,7 @@ protected function checksumTags($tags) { ...@@ -272,6 +272,7 @@ protected function checksumTags($tags) {
$query_tags[] = $tag; $query_tags[] = $tag;
} }
} }
if ($query_tags) { if ($query_tags) {
try { try {
if ($db_tags = Database::getConnection()->query('SELECT tag, invalidations FROM {cache_tags} WHERE tag IN (:tags)', array(':tags' => $query_tags))->fetchAllKeyed()) { if ($db_tags = Database::getConnection()->query('SELECT tag, invalidations FROM {cache_tags} WHERE tag IN (:tags)', array(':tags' => $query_tags))->fetchAllKeyed()) {
......
...@@ -69,7 +69,7 @@ public function read($name) { ...@@ -69,7 +69,7 @@ public function read($name) {
// Read from the storage on a cache miss and cache the data, if any. // Read from the storage on a cache miss and cache the data, if any.
$data = $this->storage->read($name); $data = $this->storage->read($name);
if ($data !== FALSE) { 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, // If the cache contained bogus data and there is no data in the storage,
// wipe the cache entry. // wipe the cache entry.
...@@ -86,7 +86,7 @@ public function write($name, array $data) { ...@@ -86,7 +86,7 @@ public function write($name, array $data) {
if ($this->storage->write($name, $data)) { if ($this->storage->write($name, $data)) {
// While not all written data is read back, setting the cache instead of // While not all written data is read back, setting the cache instead of
// just deleting it avoids cache rebuild stampedes. // 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 TRUE;
} }
return FALSE; return FALSE;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment