You are here

public function InstallablePluginManager::setCacheBackend in Markdown 8.2

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.

Overrides DefaultPluginManager::setCacheBackend

3 calls to InstallablePluginManager::setCacheBackend()
AllowedHtmlManager::__construct in src/PluginManager/AllowedHtmlManager.php
Creates the discovery object.
ExtensionManager::__construct in src/PluginManager/ExtensionManager.php
Creates the discovery object.
ParserManager::__construct in src/PluginManager/ParserManager.php
Creates the discovery object.

File

src/PluginManager/InstallablePluginManager.php, line 644

Class

InstallablePluginManager
Installable Plugin Manager.

Namespace

Drupal\markdown\PluginManager

Code

public function setCacheBackend(CacheBackendInterface $cache_backend, $cache_key, array $cache_tags = []) {
  $cache_tags[] = $cache_key;
  $cache_tags[] = "{$cache_key}:runtime";

  /** @var \Drupal\Core\Extension\ThemeHandlerInterface $themeHandler */
  $themeHandler = \Drupal::service('theme_handler');
  foreach (array_keys($themeHandler
    ->listInfo()) as $theme) {
    $cache_tags[] = "{$cache_key}:runtime:{$theme}";
  }
  parent::setCacheBackend($cache_backend, $cache_key, array_unique($cache_tags));
}