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;
}
doc_Drupal
2016-10-29 08:49:33
Comments
Leave a Comment

Please login to continue.