Commit 723ac958 authored by catch's avatar catch

Issue #2392235 by Berdir: ChainedFastBackend shouldn't write cache tags to the fast cache back-end

parent 14669c93
......@@ -160,7 +160,9 @@ public function getMultiple(&$cids, $allow_invalid = FALSE) {
if ($cids) {
foreach ($this->consistentBackend->getMultiple($cids, $allow_invalid) as $item) {
$cache[$item->cid] = $item;
$this->fastBackend->set($item->cid, $item->data, $item->expire, $item->tags);
// Don't write the cache tags to the fast backend as any cache tag
// invalidation results in an invalidation of the whole fast backend.
$this->fastBackend->set($item->cid, $item->data, $item->expire);
}
}
......@@ -173,7 +175,9 @@ public function getMultiple(&$cids, $allow_invalid = FALSE) {
public function set($cid, $data, $expire = Cache::PERMANENT, array $tags = array()) {
$this->consistentBackend->set($cid, $data, $expire, $tags);
$this->markAsOutdated();
$this->fastBackend->set($cid, $data, $expire, $tags);
// Don't write the cache tags to the fast backend as any cache tag
// invalidation results in an invalidation of the whole fast backend.
$this->fastBackend->set($cid, $data, $expire);
}
/**
......@@ -182,6 +186,11 @@ public function set($cid, $data, $expire = Cache::PERMANENT, array $tags = array
public function setMultiple(array $items) {
$this->consistentBackend->setMultiple($items);
$this->markAsOutdated();
// Don't write the cache tags to the fast backend as any cache tag
// invalidation results in an invalidation of the whole fast backend.
foreach ($items as &$item) {
unset($item['tags']);
}
$this->fastBackend->setMultiple($items);
}
......
......@@ -411,7 +411,6 @@ public function testSetMultiple() {
$this->assertEqual($cached['cid_4']->expire, $future_expiration, 'Cache expiration has been correctly set.');
$this->assertEqual($cached['cid_5']->data, $items['cid_5']['data'], 'New cache item set correctly.');
$this->assertEqual($cached['cid_5']->tags, array('test:a', 'test:b'));
// Calling ::setMultiple() with invalid cache tags.
try {
......
......@@ -103,7 +103,7 @@ public function testFallThroughToConsistentCache() {
// We should get a call to set the cache item on the fast backend.
$fast_cache->expects($this->once())
->method('set')
->with($cache_item->cid, $cache_item->data, $cache_item->expire, $cache_item->tags);
->with($cache_item->cid, $cache_item->data, $cache_item->expire);
$chained_fast_backend = new ChainedFastBackend(
$consistent_cache,
......
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