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

Breadcrumb

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

function RefinableCacheableDependencyTrait::addCacheableDependency

7 calls to RefinableCacheableDependencyTrait::addCacheableDependency()
AccessResult::inheritCacheability in core/lib/Drupal/Core/Access/AccessResult.php
Inherits the cacheability of the other access result, if any.
BubbleableMetadata::addCacheableDependency in core/lib/Drupal/Core/Render/BubbleableMetadata.php
BubbleableMetadata::addCacheableDependency in core/lib/Drupal/Core/Render/BubbleableMetadata.php
HelpSearch::prepareResults in core/modules/help/src/Plugin/Search/HelpSearch.php
Prepares search results for display.
NodeSearch::prepareResults in core/modules/node/src/Plugin/Search/NodeSearch.php
Prepares search results for rendering.

... See full list

1 method overrides RefinableCacheableDependencyTrait::addCacheableDependency()
BubbleableMetadata::addCacheableDependency in core/lib/Drupal/Core/Render/BubbleableMetadata.php

File

core/lib/Drupal/Core/Cache/RefinableCacheableDependencyTrait.php, line 15

Class

RefinableCacheableDependencyTrait
Trait for \Drupal\Core\Cache\RefinableCacheableDependencyInterface.

Namespace

Drupal\Core\Cache

Code

public function addCacheableDependency($other_object) {
    if ($other_object instanceof CacheableDependencyInterface) {
        $this->addCacheContexts($other_object->getCacheContexts());
        $this->addCacheTags($other_object->getCacheTags());
        $this->mergeCacheMaxAge($other_object->getCacheMaxAge());
    }
    else {
        // Not a cacheable dependency, this can not be cached.
        $this->cacheMaxAge = 0;
    }
    return $this;
}

API Navigation

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