function CacheCollector::clear

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

Overrides CacheCollectorInterface::clear

3 calls to CacheCollector::clear()
AliasPrefixList::clear in core/modules/path_alias/src/AliasPrefixList.php
Clears the collected cache entry.
LibraryDiscoveryCollector::clearCachedDefinitions in core/lib/Drupal/Core/Asset/LibraryDiscoveryCollector.php
Clears static and persistent cache.
State::resetCache in core/lib/Drupal/Core/State/State.php
Resets the static cache.
1 method overrides CacheCollector::clear()
AliasPrefixList::clear in core/modules/path_alias/src/AliasPrefixList.php
Clears the collected cache entry.

File

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

Class

CacheCollector
Default implementation for CacheCollectorInterface.

Namespace

Drupal\Core\Cache

Code

public function clear() {
    $this->reset();
    if ($this->tags) {
        Cache::invalidateTags($this->tags);
    }
    else {
        $this->cache
            ->delete($this->getCid());
    }
}

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