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

8.0.x
catch 2012-11-27 20:44:05 +00:00
parent 9318aa1606
commit c99f461d37
2 changed files with 3 additions and 2 deletions

View File

@ -272,6 +272,7 @@ class DatabaseBackend implements CacheBackendInterface {
$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()) {

View File

@ -69,7 +69,7 @@ class CachedStorage implements StorageInterface {
// 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 @@ class CachedStorage implements StorageInterface {
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;