Commit 41564a78 authored by catch's avatar catch
Browse files

Issue #1971158 by Berdir, beejeebus, alexpott, amateescu: Follow-up: Add...

Issue #1971158 by Berdir, beejeebus, alexpott, amateescu: Follow-up: Add loadMultiple() and listAll() caching to (cached) config storage.
parent e329d954
......@@ -20,6 +20,7 @@ services:
class: Drupal\Core\Cache\CacheBackendInterface
tags:
- { name: cache.bin }
- { name: persist }
factory_method: get
factory_service: cache_factory
arguments: [config]
......
......@@ -7,6 +7,7 @@
namespace Drupal\Core\Config;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Cache\CacheBackendInterface;
/**
......@@ -120,7 +121,7 @@ public function write($name, array $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);
$this->cache->deleteTags(array($this::FIND_BY_PREFIX_CACHE_TAG => TRUE));
Cache::deleteTags(array($this::FIND_BY_PREFIX_CACHE_TAG => TRUE));
$this->findByPrefixCache = array();
return TRUE;
}
......@@ -135,7 +136,7 @@ public function delete($name) {
// rebuilding the cache before the storage is gone.
if ($this->storage->delete($name)) {
$this->cache->delete($name);
$this->cache->deleteTags(array($this::FIND_BY_PREFIX_CACHE_TAG => TRUE));
Cache::deleteTags(array($this::FIND_BY_PREFIX_CACHE_TAG => TRUE));
$this->findByPrefixCache = array();
return TRUE;
}
......@@ -151,7 +152,7 @@ public function rename($name, $new_name) {
if ($this->storage->rename($name, $new_name)) {
$this->cache->delete($name);
$this->cache->delete($new_name);
$this->cache->deleteTags(array($this::FIND_BY_PREFIX_CACHE_TAG => TRUE));
Cache::deleteTags(array($this::FIND_BY_PREFIX_CACHE_TAG => TRUE));
$this->findByPrefixCache = array();
return TRUE;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment