DenyNoCacheRoutes::check

public DenyNoCacheRoutes::check(Response $response, Request $request)

Determines whether it is save to store a page in the cache.

Parameters

\Symfony\Component\HttpFoundation\Response $response: The response which is about to be sent to the client.

\Symfony\Component\HttpFoundation\Request $request: The request object.

Return value

string|null Either static::DENY or NULL. Calling code may attempt to store a page in the cache unless static::DENY is returned. Returns NULL if the policy policy is not specified for the given response.

Overrides ResponsePolicyInterface::check

File

core/lib/Drupal/Core/PageCache/ResponsePolicy/DenyNoCacheRoutes.php, line 38

Class

DenyNoCacheRoutes
Cache policy for routes with the 'no_cache' option set.

Namespace

Drupal\Core\PageCache\ResponsePolicy

Code

public function check(Response $response, Request $request) {
  if (($route = $this->routeMatch->getRouteObject()) && $route->getOption('no_cache')) {
    return static::DENY;
  }
}
doc_Drupal
2016-10-29 09:02:12
Comments
Leave a Comment

Please login to continue.