You are here

public function MiconIconManager::setCacheBackend in Micon 2.x

Same name and namespace in other branches
  1. 8 src/MiconIconManager.php \Drupal\micon\MiconIconManager::setCacheBackend()

Initialize the cache backend.

Plugin icons 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 Micon icons are tagged with the provided cache tags. These cache tags can then be used to clear the corresponding cached Micon icons. Note that this should be used with care! For clearing all cached Micon icons of a Micon manager, call that Micon manager's clearCachedDefinitions() method. Only use cache tags when cached Micon icons should be cleared along with other, related cache entries.

1 call to MiconIconManager::setCacheBackend()
MiconIconManager::__construct in src/MiconIconManager.php
Constructor.

File

src/MiconIconManager.php, line 121

Class

MiconIconManager
Class MiconIconManager.

Namespace

Drupal\micon

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;
}