You are here

protected function HttpCache::isFreshEnough in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-kernel/HttpCache/HttpCache.php \Symfony\Component\HttpKernel\HttpCache\HttpCache::isFreshEnough()

Checks whether the cache entry is "fresh enough" to satisfy the Request.

Parameters

Request $request A Request instance:

Response $entry A Response instance:

Return value

bool true if the cache entry if fresh enough, false otherwise

1 call to HttpCache::isFreshEnough()
HttpCache::lookup in vendor/symfony/http-kernel/HttpCache/HttpCache.php
Lookups a Response from the cache for the given Request.

File

vendor/symfony/http-kernel/HttpCache/HttpCache.php, line 522

Class

HttpCache
Cache provides HTTP caching.

Namespace

Symfony\Component\HttpKernel\HttpCache

Code

protected function isFreshEnough(Request $request, Response $entry) {
  if (!$entry
    ->isFresh()) {
    return $this
      ->lock($request, $entry);
  }
  if ($this->options['allow_revalidate'] && null !== ($maxAge = $request->headers
    ->getCacheControlDirective('max-age'))) {
    return $maxAge > 0 && $maxAge >= $entry
      ->getAge();
  }
  return true;
}