protected function CacheDecorator::setCachedDefinitions

Sets a cache of plugin definitions for the decorated discovery class.

Parameters

array $definitions: List of definitions to store in cache.

1 call to CacheDecorator::setCachedDefinitions()
CacheDecorator::getDefinitions in drupal/core/lib/Drupal/Core/Plugin/Discovery/CacheDecorator.php
Implements Drupal\Component\Plugin\Discovery\DicoveryInterface::getDefinitions().

File

drupal/core/lib/Drupal/Core/Plugin/Discovery/CacheDecorator.php, line 147
Definition of Drupal\Core\Plugin\Discovery\CacheDecorator.

Class

CacheDecorator
Enables static and persistent caching of discovered plugin definitions.

Namespace

Drupal\Core\Plugin\Discovery

Code

protected function setCachedDefinitions($definitions) {
  if (isset($this->cacheKey)) {
    cache($this->cacheBin)
      ->set($this->cacheKey, $definitions, $this->cacheExpire, $this->cacheTags);
  }
  $this->definitions = $definitions;
}