class CacheableJsonResponse

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Cache/CacheableJsonResponse.php \Drupal\Core\Cache\CacheableJsonResponse
  2. 10 core/lib/Drupal/Core/Cache/CacheableJsonResponse.php \Drupal\Core\Cache\CacheableJsonResponse
  3. 11.x core/lib/Drupal/Core/Cache/CacheableJsonResponse.php \Drupal\Core\Cache\CacheableJsonResponse

A JsonResponse that contains and can expose cacheability metadata.

Supports Drupal's caching concepts: cache tags for invalidation and cache contexts for variations.

Hierarchy

Expanded class hierarchy of CacheableJsonResponse

See also

\Drupal\Core\Cache\Cache

\Drupal\Core\Cache\CacheableMetadata

\Drupal\Core\Cache\CacheableResponseTrait

6 files declare their use of CacheableJsonResponse
ExceptionHandlingTest.php in core/tests/Drupal/KernelTests/Core/Routing/ExceptionHandlingTest.php
ExceptionJsonSubscriber.php in core/lib/Drupal/Core/EventSubscriber/ExceptionJsonSubscriber.php
ExceptionJsonSubscriberTest.php in core/tests/Drupal/Tests/Core/EventSubscriber/ExceptionJsonSubscriberTest.php
JsonRenderer.php in core/modules/system/tests/modules/common_test/src/Render/MainContent/JsonRenderer.php
PageCacheAcceptHeaderController.php in core/modules/system/tests/modules/system_test/src/Controller/PageCacheAcceptHeaderController.php

... See full list

File

core/lib/Drupal/Core/Cache/CacheableJsonResponse.php, line 17

Namespace

Drupal\Core\Cache
View source
class CacheableJsonResponse extends JsonResponse implements CacheableResponseInterface {
    use CacheableResponseTrait;

}

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