3 namespace Drupal\KernelTests\Core\Cache;
5 use Drupal\Core\Cache\ChainedFastBackend;
6 use Drupal\Core\Cache\DatabaseBackend;
7 use Drupal\Core\Cache\PhpBackend;
10 * Unit test of the fast chained backend using the generic cache unit test base.
14 class ChainedFastBackendTest extends GenericCacheBackendUnitTestBase {
17 * Creates a new instance of ChainedFastBackend.
19 * @return \Drupal\Core\Cache\ChainedFastBackend
20 * A new ChainedFastBackend object.
22 protected function createCacheBackend($bin) {
23 $consistent_backend = new DatabaseBackend(\Drupal::service('database'), \Drupal::service('cache_tags.invalidator.checksum'), $bin);
24 $fast_backend = new PhpBackend($bin, \Drupal::service('cache_tags.invalidator.checksum'));
25 $backend = new ChainedFastBackend($consistent_backend, $fast_backend, $bin);
26 // Explicitly register the cache bin as it can not work through the
27 // cache bin list in the container.
28 \Drupal::service('cache_tags.invalidator')->addInvalidator($backend);