Ejemplo n.º 1
0
 /**
  * Tries to obtain cached response.
  *
  * @param Request $request
  *
  * @return Response|null Will return cached content as response or null if there's nothing to return.
  * @throws SecurityViolationException Tried to obtain cache entry using unsafe path. Generally it should never occur
  *     unless invalid Request is passed.
  */
 public function retrieveCachedResponse(Request $request)
 {
     if ($this->isCacheable($request) !== true) {
         return null;
     }
     $cacheElement = $this->cacheManager->getElement($request->getPathInfo());
     if ($cacheElement === null) {
         return null;
     }
     return CacheResponse::createFromElement($cacheElement, $this->addStatusHeader ? 'HIT,PHP' : null);
 }