class CacheRedirect

Same name and namespace in other branches
  1. 10 core/lib/Drupal/Core/Cache/CacheRedirect.php \Drupal\Core\Cache\CacheRedirect

Defines a value object to represent a cache redirect.

@internal

Hierarchy

Expanded class hierarchy of CacheRedirect

See also

\Drupal\Core\Cache\VariationCache::get()

\Drupal\Core\Cache\VariationCache::set()

Related topics

3 files declare their use of CacheRedirect
EntityResourceTestBase.php in core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php
ResourceTestBase.php in core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php
VariationCacheTest.php in core/tests/Drupal/Tests/Core/Cache/VariationCacheTest.php

File

core/lib/Drupal/Core/Cache/CacheRedirect.php, line 14

Namespace

Drupal\Core\Cache
View source
class CacheRedirect implements CacheableDependencyInterface {
    use CacheableDependencyTrait;
    
    /**
     * Constructs a CacheRedirect object.
     *
     * @param \Drupal\Core\Cache\CacheableDependencyInterface $cacheability
     *   The cacheability to redirect to.
     *
     * @see \Drupal\Core\Cache\VariationCache::createCacheIdFast()
     */
    public function __construct(CacheableDependencyInterface $cacheability) {
        // Cache redirects only care about cache contexts.
        $this->cacheContexts = $cacheability->getCacheContexts();
    }

}

Members

Title Sort descending Modifiers Object type Summary Overrides
CacheableDependencyTrait::$cacheContexts protected property Cache contexts.
CacheableDependencyTrait::$cacheMaxAge protected property Cache max-age.
CacheableDependencyTrait::$cacheTags protected property Cache tags.
CacheableDependencyTrait::getCacheContexts public function 4
CacheableDependencyTrait::getCacheMaxAge public function 4
CacheableDependencyTrait::getCacheTags public function 4
CacheableDependencyTrait::setCacheability protected function Sets cacheability; useful for value object constructors.
CacheRedirect::__construct public function Constructs a CacheRedirect object.

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