function DefaultPluginManager::setCacheBackend

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Plugin/DefaultPluginManager.php \Drupal\Core\Plugin\DefaultPluginManager::setCacheBackend()
  2. 10 core/lib/Drupal/Core/Plugin/DefaultPluginManager.php \Drupal\Core\Plugin\DefaultPluginManager::setCacheBackend()
  3. 11.x 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.

Parameters

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

string $cache_key: Cache key prefix to use.

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.

46 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 an AggregatorPluginManager object.
ArchiverManager::__construct in core/lib/Drupal/Core/Archiver/ArchiverManager.php
Constructs an 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 157

Class

DefaultPluginManager
Base class for plugin managers.

Namespace

Drupal\Core\Plugin

Code

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.