You are here

public function ChainedFastRawBackend::__construct in Supercache 8

Same name and namespace in other branches
  1. 2.0.x src/Cache/ChainedFastRawBackend.php \Drupal\supercache\Cache\ChainedFastRawBackend::__construct()

Constructs a ChainedFastBackend object.

Parameters

CacheRawBackendInterface $consistent_backend: The consistent cache backend.

CacheRawBackendInterface $fast_backend: The fast cache backend.

CacheRawBackendInterface $fast_backend_invalidations: The fast cache backend used to store invalidations. Must always have the same binary.

Throws

\Exception When the consistent cache backend and the fast cache backend are the same service.

File

src/Cache/ChainedFastRawBackend.php, line 107
Contains \Drupal\supercache\Cache\ChainedFastRawBackend.

Class

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

Namespace

Drupal\supercache\Cache

Code

public function __construct(CacheRawBackendInterface $consistent_backend, CacheRawBackendInterface $fast_backend, $mark_as_outdated_explicit = FALSE) {
  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->doMarkAsOutdatedExplicit = $mark_as_outdated_explicit;
}