function ThemeRegistry::updateCache
Same name in other branches
- 9 core/lib/Drupal/Core/Utility/ThemeRegistry.php \Drupal\Core\Utility\ThemeRegistry::updateCache()
- 8.9.x core/lib/Drupal/Core/Utility/ThemeRegistry.php \Drupal\Core\Utility\ThemeRegistry::updateCache()
- 10 core/lib/Drupal/Core/Utility/ThemeRegistry.php \Drupal\Core\Utility\ThemeRegistry::updateCache()
Overrides CacheCollector::updateCache
1 call to ThemeRegistry::updateCache()
- ThemeRegistry::__construct in core/
lib/ Drupal/ Core/ Utility/ ThemeRegistry.php - Constructs a ThemeRegistry object.
File
-
core/
lib/ Drupal/ Core/ Utility/ ThemeRegistry.php, line 136
Class
- ThemeRegistry
- Builds the run-time theme registry.
Namespace
Drupal\Core\UtilityCode
protected function updateCache($lock = TRUE) {
if (!$this->persistable) {
return;
}
// @todo Is the custom implementation necessary?
$data = [];
foreach ($this->keysToPersist as $offset => $persist) {
if ($persist) {
$data[$offset] = $this->storage[$offset];
}
}
if (empty($data)) {
return;
}
$lock_name = $this->cid . ':' . __CLASS__;
if (!$lock || $this->lock
->acquire($lock_name)) {
if ($cached = $this->cache
->get($this->cid)) {
// Use array merge instead of union so that filled in values in $data
// overwrite empty values in the current cache.
$data = array_merge($cached->data, $data);
}
else {
$registry = $this->initializeRegistry();
$data = array_merge($registry, $data);
}
$this->cache
->set($this->cid, $data, Cache::PERMANENT, $this->tags);
if ($lock) {
$this->lock
->release($lock_name);
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.