diff -u b/core/lib/Drupal/Core/Config/CachedStorage.php b/core/lib/Drupal/Core/Config/CachedStorage.php --- b/core/lib/Drupal/Core/Config/CachedStorage.php +++ b/core/lib/Drupal/Core/Config/CachedStorage.php @@ -177,17 +177,32 @@ */ public function listAll($prefix = '') { // Do not cache when a prefix is not provided. - if (!$prefix) { - return $this->findAll(); + if ($prefix) { + return $this->findByPrefix($prefix); } + return $this->storage->listAll(); + } - // Check the static cache first. + /** + * Finds configuration object names starting with a given prefix. + * + * Given the following configuration objects: + * - node.type.article + * - node.type.page + * + * Passing the prefix 'node.type.' will return an array containing the above + * names. + * + * @param string $prefix + * The prefix to search for + * + * @return array + * An array containing matching configuration object names. + */ + protected function findByPrefix($prefix) { if (!isset(static::$listAllCache[$prefix])) { - // The : character is not allowed in config file names, so this can not // conflict. - // @todo: Maintain a single cache entry for this, similar to a cache - // collector? if ($cache = $this->cache->get('list:' . $prefix)) { static::$listAllCache[$prefix] = $cache->data; } @@ -203,10 +217,0 @@ - * Finds all configuration object names. - * - * @return array - * An array containing all configuration object names. - */ - protected function findAll() { - return $this->storage->listAll(); - } - - /**