Default implementation for CacheCollectorInterface.
By default, the class accounts for caches where calling functions might request keys that won't exist even after a cache rebuild. This prevents situations where a cache rebuild would be triggered over and over due to a 'missing' item. These cases are stored internally as a value of NULL. This means that the CacheCollector::get() method must be overridden if caching data where the values can legitimately be NULL, and where CacheCollector->has() needs to correctly return (equivalent to array_key_exists() vs. isset()). This should not be necessary in the majority of cases.
Hierarchy
- class \Drupal\Core\Cache\CacheCollector implements CacheCollectorInterface, DestructableInterface
Related topics
- Cache API
- Information about the Drupal Cache API
File
- core/lib/Drupal/Core/Cache/CacheCollector.php, line 24
Namespace
Drupal\Core\Cache
Members
Name | Modifiers | Type | Description |
---|---|---|---|
CacheCollector::$cache | protected | property | The cache backend that should be used. |
CacheCollector::$cacheCreated | protected | property | Stores the cache creation time. |
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::$lock | protected | property | The lock backend that should be used. |
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 | Clears the collected cache entry. Overrides CacheCollectorInterface::clear |
CacheCollector::delete | public | function | Deletes the element. Overrides CacheCollectorInterface::delete |
CacheCollector::destruct | public | function | Performs destruct operations. Overrides DestructableInterface::destruct |
CacheCollector::get | public | function | Gets value from the cache. Overrides CacheCollectorInterface::get |
CacheCollector::getCid | protected | function | Gets the cache ID. |
CacheCollector::has | public | function | Returns whether data exists for this key. Overrides CacheCollectorInterface::has |
CacheCollector::invalidateCache | protected | function | Invalidate the cache. |
CacheCollector::lazyLoadCache | protected | function | Loads the cache if not already done. |
CacheCollector::normalizeLockName | protected | function | Normalizes a cache ID in order to comply with database limitations. |
CacheCollector::persist | protected | function | Flags an offset value to be written to the persistent cache. |
CacheCollector::reset | public | function | Resets the local cache. Overrides CacheCollectorInterface::reset |
CacheCollector::resolveCacheMiss | abstract protected | function | Resolves a cache miss. |
CacheCollector::set | public | function | Implements \Drupal\Core\Cache\CacheCollectorInterface::set(). Overrides CacheCollectorInterface::set |
CacheCollector::updateCache | protected | function | Writes a value to the persistent cache immediately. |
CacheCollector::__construct | public | function | Constructs a CacheCollector object. |
Please login to continue.