Commit 8f785ff8 authored by catch's avatar catch
Browse files

Issue #1637478 by alexpott, pounard, catch, fubhy: Fixed Add a PHP array cache backend.

parent 4b5fad54
......@@ -21,7 +21,7 @@ class MemoryBackend implements CacheBackendInterface {
/**
* Array to store cache objects.
*/
protected $cache;
protected $cache = array();
/**
* All tags invalidated during the request.
......@@ -202,7 +202,7 @@ protected function flattenTags(array $tags) {
}
}
else {
$flat_tags["$namespace:$value"] = "$namespace:$values";
$flat_tags["$namespace:$values"] = "$namespace:$values";
}
}
return $flat_tags;
......
......@@ -411,6 +411,18 @@ function testClearTags() {
$backend = $this->getCacheBackend();
// Create two cache entries with the same tag and tag value.
$backend->set('test_cid_clear1', $this->defaultValue, CacheBackendInterface::CACHE_PERMANENT, array('test_tag' => 2));
$backend->set('test_cid_clear2', $this->defaultValue, CacheBackendInterface::CACHE_PERMANENT, array('test_tag' => 2));
$this->assertTrue($this->checkCacheExists('test_cid_clear1')
&& $this->checkCacheExists('test_cid_clear2'),
'Two cache items were created.');
// Invalidate test_tag of value 1. This should invalidate both entries.
$backend->invalidateTags(array('test_tag' => 2));
$this->assertFalse($this->checkCacheExists('test_cid_clear1')
|| $this->checkCacheExists('test_cid_clear2'),
'Two caches removed after clearing a cache tag.');
// Create two cache entries with the same tag and an array tag value.
$backend->set('test_cid_clear1', $this->defaultValue, CacheBackendInterface::CACHE_PERMANENT, array('test_tag' => array(1)));
$backend->set('test_cid_clear2', $this->defaultValue, CacheBackendInterface::CACHE_PERMANENT, array('test_tag' => array(1)));
$this->assertTrue($this->checkCacheExists('test_cid_clear1')
......
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