You are here

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

Constructs a Drupal8CacheBackend object.

Parameters

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

1 call to D8Cache::__construct()
D8CacheAttachmentsCollector::__construct in ./d8cache-ac.cache.inc
Constructs a Drupal8CacheBackend object.
1 method overrides D8Cache::__construct()
D8CacheAttachmentsCollector::__construct in ./d8cache-ac.cache.inc
Constructs a Drupal8CacheBackend object.

File

./d8cache.cache.inc, line 46

Class

D8Cache
Defines a Drupal 8 cacheable metadata aware cache backend.

Code

public function __construct($bin) {
  global $conf;
  $this->bin = $bin;
  $class = variable_get('d8cache_cache_class_' . $bin);
  if (!isset($class)) {
    $class = variable_get('d8cache_cache_default_class');
  }
  if (!isset($class)) {
    $class = variable_get('cache_default_class', 'DrupalDatabaseCache');
  }
  $this->backend = new $class($bin);
  $this->configuration = array();
  $configuration = variable_get('d8cache_cache_options', array());
  if (isset($configuration[$bin])) {
    $this->configuration = $configuration[$bin];
  }
}