You are here

public function DefaultPluginManager::setCacheBackend in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Plugin/DefaultPluginManager.php \Drupal\Core\Plugin\DefaultPluginManager::setCacheBackend()

Initialize the cache backend.

Plugin definitions are cached using the provided cache backend. The interface language is added as a suffix to the cache key.

Parameters

\Drupal\Core\Cache\CacheBackendInterface $cache_backend: Cache backend instance to use.

string $cache_key: Cache key prefix to use, the language code will be appended automatically.

array $cache_tags: (optional) When providing a list of cache tags, the cached plugin definitions are tagged with the provided cache tags. These cache tags can then be used to clear the corresponding cached plugin definitions. Note that this should be used with care! For clearing all cached plugin definitions of a plugin manager, call that plugin manager's clearCachedDefinitions() method. Only use cache tags when cached plugin definitions should be cleared along with other, related cache entries.

36 calls to DefaultPluginManager::setCacheBackend()
ActionManager::__construct in core/lib/Drupal/Core/Action/ActionManager.php
Constructs a new class instance.
AggregatorPluginManager::__construct in core/modules/aggregator/src/Plugin/AggregatorPluginManager.php
Constructs a AggregatorPluginManager object.
ArchiverManager::__construct in core/lib/Drupal/Core/Archiver/ArchiverManager.php
Constructs a ArchiverManager object.
BlockManager::__construct in core/lib/Drupal/Core/Block/BlockManager.php
Constructs a new \Drupal\Core\Block\BlockManager object.
BreakpointManager::__construct in core/modules/breakpoint/src/BreakpointManager.php
Constructs a new BreakpointManager instance.

... See full list

File

core/lib/Drupal/Core/Plugin/DefaultPluginManager.php, line 144
Contains \Drupal\Core\Plugin\DefaultPluginManager.

Class

DefaultPluginManager
Base class for plugin managers.

Namespace

Drupal\Core\Plugin

Code

public function setCacheBackend(CacheBackendInterface $cache_backend, $cache_key, array $cache_tags = array()) {
  assert('\\Drupal\\Component\\Assertion\\Inspector::assertAllStrings($cache_tags)', 'Cache Tags must be strings.');
  $this->cacheBackend = $cache_backend;
  $this->cacheKey = $cache_key;
  $this->cacheTags = $cache_tags;
}