CacheableResponseTrait::getCacheableMetadata

public CacheableResponseTrait::getCacheableMetadata() Returns the cacheability metadata for this response. Return value \Drupal\Core\Cache\CacheableMetadata Overrides CacheableResponseInterface::getCacheableMetadata File core/lib/Drupal/Core/Cache/CacheableResponseTrait.php, line 37 Class CacheableResponseTrait Provides an implementation of CacheableResponseInterface. Namespace Drupal\Core\Cache Code public function getCacheableMetadata() { // A trait doesn't have a constructor, so

CacheableResponseTrait::addCacheableDependency

public CacheableResponseTrait::addCacheableDependency($dependency) Adds a dependency on an object: merges its cacheability metadata. For instance, when a response depends on some configuration, an entity, or an access result, we must make sure their cacheability metadata is present on the response. This method makes doing that simple. Parameters \Drupal\Core\Cache\CacheableDependencyInterface|mixed $dependency: The dependency. If the object implements CacheableDependencyInterface, then its cac

CacheableResponseTrait::$cacheabilityMetadata

The cacheability metadata. Type: \Drupal\Core\Cache\CacheableMetadata File core/lib/Drupal/Core/Cache/CacheableResponseTrait.php, line 17 Class CacheableResponseTrait Provides an implementation of CacheableResponseInterface. Namespace Drupal\Core\Cache Code protected $cacheabilityMetadata;

CacheableResponseTrait

Provides an implementation of CacheableResponseInterface. Hierarchy trait \Drupal\Core\Cache\CacheableResponseTrait See also \Drupal\Core\Cache\CacheableResponseInterface File core/lib/Drupal/Core/Cache/CacheableResponseTrait.php, line 10 Namespace Drupal\Core\Cache Members Name Modifiers Type Description CacheableResponseTrait::$cacheabilityMetadata protected property The cacheability metadata. CacheableResponseTrait::addCacheableDependency public function Adds

CacheableResponseInterface::getCacheableMetadata

public CacheableResponseInterface::getCacheableMetadata() Returns the cacheability metadata for this response. Return value \Drupal\Core\Cache\CacheableMetadata File core/lib/Drupal/Core/Cache/CacheableResponseInterface.php, line 35 Class CacheableResponseInterface Defines an interface for responses that can expose cacheability metadata. Namespace Drupal\Core\Cache Code public function getCacheableMetadata();

CacheableResponseInterface::addCacheableDependency

public CacheableResponseInterface::addCacheableDependency($dependency) Adds a dependency on an object: merges its cacheability metadata. For instance, when a response depends on some configuration, an entity, or an access result, we must make sure their cacheability metadata is present on the response. This method makes doing that simple. Parameters \Drupal\Core\Cache\CacheableDependencyInterface|mixed $dependency: The dependency. If the object implements CacheableDependencyInterface, then its

CacheableResponseInterface

Defines an interface for responses that can expose cacheability metadata. Hierarchy interface \Drupal\Core\Cache\CacheableResponseInterface See also \Drupal\Core\Cache\CacheableResponseTrait File core/lib/Drupal/Core/Cache/CacheableResponseInterface.php, line 10 Namespace Drupal\Core\Cache Members Name Modifiers Type Description CacheableResponseInterface::addCacheableDependency public function Adds a dependency on an object: merges its cacheability metadata. Cacheabl

CacheableResponse

A response that contains and can expose cacheability metadata. Supports Drupal's caching concepts: cache tags for invalidation and cache contexts for variations. Hierarchy class \Symfony\Component\HttpFoundation\Responseclass \Drupal\Core\Cache\CacheableResponse implements CacheableResponseInterface uses CacheableResponseTrait See also \Drupal\Core\Cache\Cache \Drupal\Core\Cache\CacheableMetadata \Drupal\Core\Cache\CacheableResponseTrait File core/lib/Drupal/Core/Cache/CacheableResponse.ph

CacheableMetadata::setCacheTags

public CacheableMetadata::setCacheTags(array $cache_tags) Sets cache tags. Parameters string[] $cache_tags: The cache tags to be associated. Return value $this File core/lib/Drupal/Core/Cache/CacheableMetadata.php, line 29 Class CacheableMetadata Defines a generic class for passing cacheability metadata. Namespace Drupal\Core\Cache Code public function setCacheTags(array $cache_tags) { $this->cacheTags = $cache_tags; return $this; }

CacheableMetadata::setCacheMaxAge

public CacheableMetadata::setCacheMaxAge($max_age) Sets the maximum age (in seconds). Defaults to Cache::PERMANENT Parameters int $max_age: The max age to associate. Return value $this Throws \InvalidArgumentException If a non-integer value is supplied. File core/lib/Drupal/Core/Cache/CacheableMetadata.php, line 74 Class CacheableMetadata Defines a generic class for passing cacheability metadata. Namespace Drupal\Core\Cache Code public function setCacheMaxAge($max_age) { if (!is_i