function CachedStorage::read

Same name in other branches
  1. 9 core/lib/Drupal/Core/Config/CachedStorage.php \Drupal\Core\Config\CachedStorage::read()
  2. 10 core/lib/Drupal/Core/Config/CachedStorage.php \Drupal\Core\Config\CachedStorage::read()
  3. 11.x core/lib/Drupal/Core/Config/CachedStorage.php \Drupal\Core\Config\CachedStorage::read()

Overrides StorageInterface::read

File

core/lib/Drupal/Core/Config/CachedStorage.php, line 65

Class

CachedStorage
Defines the cached storage.

Namespace

Drupal\Core\Config

Code

public function read($name) {
    $cache_key = $this->getCacheKey($name);
    if ($cache = $this->cache
        ->get($cache_key)) {
        // The cache contains either the cached configuration data or FALSE
        // if the configuration file does not exist.
        return $cache->data;
    }
    // Read from the storage on a cache miss and cache the data. Also cache
    // information about missing configuration objects.
    $data = $this->storage
        ->read($name);
    $this->cache
        ->set($cache_key, $data);
    return $data;
}

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