function AliasManager::cacheClear

Same name and namespace in other branches
  1. 9 core/modules/path_alias/src/AliasManager.php \Drupal\path_alias\AliasManager::cacheClear()
  2. 8.9.x core/lib/Drupal/Core/Path/AliasManager.php \Drupal\Core\Path\AliasManager::cacheClear()
  3. 11.x core/modules/path_alias/src/AliasManager.php \Drupal\path_alias\AliasManager::cacheClear()

Clears the static caches in alias manager and rebuilds the whitelist.

Parameters

$source: Source path of the alias that is being inserted/updated. If omitted, the entire lookup static cache will be cleared and the whitelist will be rebuilt.

Overrides AliasManagerInterface::cacheClear

File

core/modules/path_alias/src/AliasManager.php, line 266

Class

AliasManager
The default alias manager implementation.

Namespace

Drupal\path_alias

Code

public function cacheClear($source = NULL) {
  // Note this method does not flush the preloaded path lookup cache. This is
  // because if a path is missing from this cache, it still results in the
  // alias being loaded correctly, only less efficiently.
  if ($source) {
    foreach (array_keys($this->lookupMap) as $lang) {
      unset($this->lookupMap[$lang][$source]);
    }
  }
  else {
    $this->lookupMap = [];
  }
  $this->noPath = [];
  $this->noAlias = [];
  $this->langcodePreloaded = [];
  $this->preloadedPathLookups = [];
  $this->pathAliasWhitelistRebuild($source);
}

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