public function CachedStorage::read

public CachedStorage::read($name)

Reads configuration data from the storage.

Parameters

string $name: The name of a configuration object to load.

Return value

array|bool The configuration data stored for the configuration object name. If no configuration data exists for the given name, FALSE is returned.

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;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Config!CachedStorage.php/function/CachedStorage::read/8.1.x