You are here

class NoServerError in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/PageCache/ResponsePolicy/NoServerError.php \Drupal\Core\PageCache\ResponsePolicy\NoServerError

A policy denying caching of a server error (HTTP 5xx) responses.

Hierarchy

Expanded class hierarchy of NoServerError

1 string reference to 'NoServerError'
core.services.yml in core/core.services.yml
core/core.services.yml
1 service uses NoServerError
page_cache_no_server_error in core/core.services.yml
Drupal\Core\PageCache\ResponsePolicy\NoServerError

File

core/lib/Drupal/Core/PageCache/ResponsePolicy/NoServerError.php, line 12

Namespace

Drupal\Core\PageCache\ResponsePolicy
View source
class NoServerError implements ResponsePolicyInterface {

  /**
   * {@inheritdoc}
   */
  public function check(Response $response, Request $request) {
    if ($response
      ->isServerError()) {
      return static::DENY;
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
NoServerError::check public function Determines whether it is save to store a page in the cache. Overrides ResponsePolicyInterface::check
ResponsePolicyInterface::DENY constant Deny storage of a page in the cache.