Revert "Issue #2662844 by penyaskito, dawehner, catch: cache.backend.chainedfast misbehaves in some situations"
This reverts commit 4eb87a26df
.
8.3.x
parent
4a53d2f4cd
commit
2766d1a729
|
@ -87,16 +87,8 @@ class ChainedFastBackend implements CacheBackendInterface, CacheTagsInvalidatorI
|
||||||
* The fast cache backend.
|
* The fast cache backend.
|
||||||
* @param string $bin
|
* @param string $bin
|
||||||
* The cache bin for which the object is created.
|
* The cache bin for which the object is created.
|
||||||
*
|
|
||||||
* @throws \Exception
|
|
||||||
* When the consistent cache backend and the fast cache backend are the same
|
|
||||||
* service.
|
|
||||||
*/
|
*/
|
||||||
public function __construct(CacheBackendInterface $consistent_backend, CacheBackendInterface $fast_backend, $bin) {
|
public function __construct(CacheBackendInterface $consistent_backend, CacheBackendInterface $fast_backend, $bin) {
|
||||||
if ($consistent_backend == $fast_backend) {
|
|
||||||
// @todo: should throw a proper exception. See https://www.drupal.org/node/2751847.
|
|
||||||
trigger_error('Consistent cache backend and fast cache backend cannot use the same service.', E_USER_ERROR);
|
|
||||||
}
|
|
||||||
$this->consistentBackend = $consistent_backend;
|
$this->consistentBackend = $consistent_backend;
|
||||||
$this->fastBackend = $fast_backend;
|
$this->fastBackend = $fast_backend;
|
||||||
$this->bin = 'cache_' . $bin;
|
$this->bin = 'cache_' . $bin;
|
||||||
|
|
|
@ -33,21 +33,6 @@ class ChainedFastBackendTest extends UnitTestCase {
|
||||||
*/
|
*/
|
||||||
protected $bin;
|
protected $bin;
|
||||||
|
|
||||||
/**
|
|
||||||
* Tests that chained fast backend cannot be constructed with two instances of
|
|
||||||
* the same service.
|
|
||||||
*/
|
|
||||||
public function testConsistentAndFastBackendCannotBeTheSameService() {
|
|
||||||
// ToDo: It should throw a proper exception. See https://www.drupal.org/node/2751847.
|
|
||||||
$this->setExpectedException(\PHPUnit_Framework_Error::class, 'Consistent cache backend and fast cache backend cannot use the same service.');
|
|
||||||
$cache = $this->getMock('Drupal\Core\Cache\CacheBackendInterface');
|
|
||||||
$chained_fast_backend = new ChainedFastBackend(
|
|
||||||
$cache,
|
|
||||||
$cache,
|
|
||||||
'foo'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests a get() on the fast backend, with no hit on the consistent backend.
|
* Tests a get() on the fast backend, with no hit on the consistent backend.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue