public function ThemeRegistry::set

Overrides CacheArray::set().

Overrides CacheArray::set

1 call to ThemeRegistry::set()
ThemeRegistry::__construct in drupal/core/lib/Drupal/Core/Utility/ThemeRegistry.php
Constructs a ThemeRegistry object.

File

drupal/core/lib/Drupal/Core/Utility/ThemeRegistry.php, line 125
Definition of Drupal\Core\Utility\ThemeRegistry

Class

ThemeRegistry
Builds the run-time theme registry.

Namespace

Drupal\Core\Utility

Code

public function set($data, $lock = TRUE) {
  $lock_name = $this->cid . ':' . $this->bin;
  if (!$lock || lock()
    ->acquire($lock_name)) {
    if ($cached = cache($this->bin)
      ->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);
    }
    cache($this->bin)
      ->set($this->cid, $data, CacheBackendInterface::CACHE_PERMANENT, $this->tags);
    if ($lock) {
      lock()
        ->release($lock_name);
    }
  }
}