class YamlCacheCollector

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Utility/YamlCacheCollector.php \Drupal\Core\Utility\YamlCacheCollector

Caches YAML parsing in a cache collector.

Hierarchy

Expanded class hierarchy of YamlCacheCollector

7 files declare their use of YamlCacheCollector
FileStorage.php in core/lib/Drupal/Core/Config/FileStorage.php
LibraryDiscoveryParser.php in core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php
LibraryDiscoveryParserTest.php in core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryParserTest.php
LocalTaskIntegrationTestBase.php in core/tests/Drupal/Tests/Core/Menu/LocalTaskIntegrationTestBase.php
LocalTaskManagerTest.php in core/tests/Drupal/Tests/Core/Menu/LocalTaskManagerTest.php

... See full list

1 string reference to 'YamlCacheCollector'
core.services.yml in core/core.services.yml
core/core.services.yml
6 services use YamlCacheCollector
config.parsing_cache in core/core.services.yml
Drupal\Core\Utility\YamlCacheCollector
library.parsing_cache in core/core.services.yml
Drupal\Core\Utility\YamlCacheCollector
local_action.yaml_cache_collector in core/core.services.yml
Drupal\Core\Utility\YamlCacheCollector
local_task.yaml_cache_collector in core/core.services.yml
Drupal\Core\Utility\YamlCacheCollector
menu_link.yaml_cache_collector in core/core.services.yml
Drupal\Core\Utility\YamlCacheCollector

... See full list

File

core/lib/Drupal/Core/Utility/YamlCacheCollector.php, line 15

Namespace

Drupal\Core\Utility
View source
class YamlCacheCollector extends FileParsingCacheCollectorBase {
  
  /**
   * Creates an instance of the class with a memory cache.
   *
   * This can be used where there is zero expectation of a cache hit rate or in
   * testing.
   */
  public static function createWithMemoryCache() : static {
    return new static('static_cache_key', new MemoryCache(new Time()), new NullLockBackend(), new Time());
  }
  
  /**
   * {@inheritdoc}
   */
  protected function parseFile($file) : array {
    return Yaml::decode($file) ?? [];
  }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title Overrides
CacheCollector::$cache protected property The cache backend that should be used. 1
CacheCollector::$cacheInvalidated protected property Flag that indicates of the cache has been invalidated.
CacheCollector::$cacheLoaded protected property Indicates if the collected cache was already loaded.
CacheCollector::$cid protected property The cache id that is used for the cache entry.
CacheCollector::$keysToPersist protected property An array of keys to add to the cache on service termination.
CacheCollector::$keysToRemove protected property An array of keys to remove from the cache on service termination.
CacheCollector::$loadedData protected property The cache item's data as loaded during this request, or NULL if none.
CacheCollector::$lock protected property The lock backend that should be used. 1
CacheCollector::$storage protected property Storage for the data itself.
CacheCollector::$tags protected property A list of tags that are used for the cache entry.
CacheCollector::clear public function Overrides CacheCollectorInterface::clear 1
CacheCollector::delete public function Overrides CacheCollectorInterface::delete 1
CacheCollector::destruct public function Overrides DestructableInterface::destruct 1
CacheCollector::fingerprint protected function Computes a fingerprint of cache item data for change detection.
CacheCollector::getCid protected function Gets the cache ID. 3
CacheCollector::has public function Overrides CacheCollectorInterface::has 2
CacheCollector::invalidateCache protected function Invalidate the cache.
CacheCollector::lazyLoadCache protected function Loads the cache if not already done. 1
CacheCollector::persist protected function Flags an offset value to be written to the persistent cache.
CacheCollector::reset public function Overrides CacheCollectorInterface::reset 1
CacheCollector::set public function Implements \Drupal\Core\Cache\CacheCollectorInterface::set(). Overrides CacheCollectorInterface::set 4
FileParsingCacheCollectorBase::get public function Overrides CacheCollector::get
FileParsingCacheCollectorBase::resolveCacheMiss public function Overrides CacheCollector::resolveCacheMiss
FileParsingCacheCollectorBase::updateCache public function Overrides CacheCollector::updateCache
FileParsingCacheCollectorBase::__construct public function Overrides CacheCollector::__construct
YamlCacheCollector::createWithMemoryCache public static function Creates an instance of the class with a memory cache.
YamlCacheCollector::parseFile protected function Overrides FileParsingCacheCollectorBase::parseFile

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