Example #1
0
 /**
  * Checks whether the cache entry is "fresh enough" to satisfy the Request.
  *
  * @param Symfony\Components\HttpFoundation\Request  $request A Request instance
  * @param Symfony\Components\HttpFoundation\Response $entry   A Response instance
  *
  * @return Boolean true if the cache entry if fresh enough, false otherwise
  */
 protected function isFreshEnough(Request $request, Response $entry)
 {
     if (!$entry->isFresh()) {
         return $this->lock($request, $entry);
     }
     if ($this->options['allow_revalidate'] && null !== ($maxAge = $request->headers->getCacheControl()->getMaxAge())) {
         return $maxAge > 0 && $maxAge >= $entry->getAge();
     }
     return true;
 }