public function DefaultPluginManager::setCacheBackend in Service Container 7
Same name and namespace in other branches
- 7.2 lib/Drupal/Component/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.
File
- lib/
Drupal/ Component/ Plugin/ DefaultPluginManager.php, line 156 - Contains \Drupal\Core\Plugin\DefaultPluginManager.
Class
- DefaultPluginManager
- Base class for plugin managers.
Namespace
Drupal\Core\PluginCode
public function setCacheBackend(CacheBackendInterface $cache_backend, $cache_key, array $cache_tags = array()) {
Cache::validateTags($cache_tags);
$this->cacheBackend = $cache_backend;
$this->cacheKey = $cache_key;
$this->cacheTags = $cache_tags;
}