예제 #1
0
파일: Cache.php 프로젝트: bill97420/symfony
 /**
  * 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;
 }