function CacheCollector::__construct

Same name in other branches
  1. 9 core/lib/Drupal/Core/Cache/CacheCollector.php \Drupal\Core\Cache\CacheCollector::__construct()
  2. 8.9.x core/lib/Drupal/Core/Cache/CacheCollector.php \Drupal\Core\Cache\CacheCollector::__construct()
  3. 11.x core/lib/Drupal/Core/Cache/CacheCollector.php \Drupal\Core\Cache\CacheCollector::__construct()

Constructs a CacheCollector object.

Parameters

string $cid: The cid for the array being cached.

\Drupal\Core\Cache\CacheBackendInterface $cache: The cache backend.

\Drupal\Core\Lock\LockBackendInterface $lock: The lock backend.

array $tags: (optional) The tags to specify for the cache item.

5 calls to CacheCollector::__construct()
AliasWhitelist::__construct in core/modules/path_alias/src/AliasWhitelist.php
Constructs an AliasWhitelist object.
BlockContentUuidLookup::__construct in core/modules/block_content/src/BlockContentUuidLookup.php
Constructs a BlockContentUuidLookup instance.
LibraryDiscoveryCollector::__construct in core/lib/Drupal/Core/Asset/LibraryDiscoveryCollector.php
Constructs a CacheCollector object.
MenuActiveTrail::__construct in core/lib/Drupal/Core/Menu/MenuActiveTrail.php
Constructs a \Drupal\Core\Menu\MenuActiveTrail object.
State::__construct in core/lib/Drupal/Core/State/State.php
Constructs a State object.
7 methods override CacheCollector::__construct()
AliasWhitelist::__construct in core/modules/path_alias/src/AliasWhitelist.php
Constructs an AliasWhitelist object.
BlockContentUuidLookup::__construct in core/modules/block_content/src/BlockContentUuidLookup.php
Constructs a BlockContentUuidLookup instance.
LibraryDiscoveryCollector::__construct in core/lib/Drupal/Core/Asset/LibraryDiscoveryCollector.php
Constructs a CacheCollector object.
LocaleLookup::__construct in core/modules/locale/src/LocaleLookup.php
Constructs a LocaleLookup object.
MenuActiveTrail::__construct in core/lib/Drupal/Core/Menu/MenuActiveTrail.php
Constructs a \Drupal\Core\Menu\MenuActiveTrail object.

... See full list

File

core/lib/Drupal/Core/Cache/CacheCollector.php, line 114

Class

CacheCollector
Default implementation for CacheCollectorInterface.

Namespace

Drupal\Core\Cache

Code

public function __construct($cid, CacheBackendInterface $cache, LockBackendInterface $lock, array $tags = []) {
    assert(Inspector::assertAllStrings($tags), 'Cache tags must be strings.');
    $this->cid = $cid;
    $this->cache = $cache;
    $this->tags = $tags;
    $this->lock = $lock;
}

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