W3cubDocs

/Drupal 8

public function ChainedFastBackend::__construct

public ChainedFastBackend::__construct(CacheBackendInterface $consistent_backend, CacheBackendInterface $fast_backend, $bin)

Constructs a ChainedFastBackend object.

Parameters

\Drupal\Core\Cache\CacheBackendInterface $consistent_backend: The consistent cache backend.

\Drupal\Core\Cache\CacheBackendInterface $fast_backend: The fast cache backend.

string $bin: 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.

File

core/lib/Drupal/Core/Cache/ChainedFastBackend.php, line 95

Class

ChainedFastBackend
Defines a backend with a fast and a consistent backend chain.

Namespace

Drupal\Core\Cache

Code

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->fastBackend = $fast_backend;
  $this->bin = 'cache_' . $bin;
  $this->lastWriteTimestamp = NULL;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Cache!ChainedFastBackend.php/function/ChainedFastBackend::__construct/8.1.x