You are here

public function D8CacheAttachmentsCollector::__construct in Drupal 8 Cache Backport 7

Constructs a Drupal8CacheBackend object.

Parameters

string $bin: The cache bin for which the object is created.

Overrides D8Cache::__construct

File

./d8cache-ac.cache.inc, line 74

Class

D8CacheAttachmentsCollector
Special cache backend that tracks attachments.

Code

public function __construct($bin) {
  $this->isValid = TRUE;
  if (!function_exists('drupal_process_attached')) {

    // Something is trying to use us during early bootstrap.
    // Fall back to baseline D8Cache behavior for safety.
    $this->isValid = FALSE;

    // Additionally, prevent the request from saving to cache, and warn
    // loudly that we are in an unsupported configuration.
    $t = get_t();
    drupal_set_message($t('D8CacheAttachmentsCollector is not designed for early page cache! Please switch cache_page to D8Cache in settings.php!'), 'error');
  }
  parent::__construct($bin);
}