a93b674d5cf0ecc61dbd09fb92e7eb33b0e0ad4c
[yaffs-website] / web / core / tests / Drupal / KernelTests / Core / Cache / ChainedFastBackendTest.php
1 <?php
2
3 namespace Drupal\KernelTests\Core\Cache;
4
5 use Drupal\Core\Cache\ChainedFastBackend;
6 use Drupal\Core\Cache\DatabaseBackend;
7 use Drupal\Core\Cache\PhpBackend;
8
9 /**
10  * Unit test of the fast chained backend using the generic cache unit test base.
11  *
12  * @group Cache
13  */
14 class ChainedFastBackendTest extends GenericCacheBackendUnitTestBase {
15
16   /**
17    * Creates a new instance of ChainedFastBackend.
18    *
19    * @return \Drupal\Core\Cache\ChainedFastBackend
20    *   A new ChainedFastBackend object.
21    */
22   protected function createCacheBackend($bin) {
23     $consistent_backend = new DatabaseBackend(\Drupal::service('database'), \Drupal::service('cache_tags.invalidator.checksum'), $bin, 100);
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);
29     return $backend;
30   }
31
32 }