function DefaultPluginManager::setCacheBackend

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

48 calls to DefaultPluginManager::setCacheBackend()
ActionManager::__construct in core/lib/Drupal/Core/Action/ActionManager.php
Constructs a new class instance.
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.
CKEditor4To5UpgradePluginManager::__construct in core/modules/ckeditor5/src/Plugin/CKEditor4To5UpgradePluginManager.php
Constructs a CKEditor4To5UpgradePluginManager object.

... See full list

File

core/lib/Drupal/Core/Plugin/DefaultPluginManager.php, line 189

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.