Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. CacheableDependencyTrait.php

function CacheableDependencyTrait::setCacheability

Sets cacheability; useful for value object constructors.

Parameters

\Drupal\Core\Cache\CacheableDependencyInterface $cacheability: The cacheability to set.

Return value

$this

20 calls to CacheableDependencyTrait::setCacheability()
CacheableAccessDeniedHttpException::__construct in core/lib/Drupal/Core/Http/Exception/CacheableAccessDeniedHttpException.php
CacheableBadRequestHttpException::__construct in core/lib/Drupal/Core/Http/Exception/CacheableBadRequestHttpException.php
CacheableConflictHttpException::__construct in core/lib/Drupal/Core/Http/Exception/CacheableConflictHttpException.php
CacheableGoneHttpException::__construct in core/lib/Drupal/Core/Http/Exception/CacheableGoneHttpException.php
CacheableHttpException::__construct in core/lib/Drupal/Core/Http/Exception/CacheableHttpException.php

... See full list

File

core/lib/Drupal/Core/Cache/CacheableDependencyTrait.php, line 39

Class

CacheableDependencyTrait
Trait for \Drupal\Core\Cache\CacheableDependencyInterface.

Namespace

Drupal\Core\Cache

Code

protected function setCacheability(CacheableDependencyInterface $cacheability) {
    $this->cacheContexts = $cacheability->getCacheContexts();
    $this->cacheTags = $cacheability->getCacheTags();
    $this->cacheMaxAge = $cacheability->getCacheMaxAge();
    return $this;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal