Symfony\Component\HttpFoundation\Response::mustRevalidate PHP Метод

mustRevalidate() публичный Метод

This method indicates that the response must not be served stale by a cache in any circumstance without first revalidating with the origin. When present, the TTL of the response should not be overridden to be greater than the value provided by the origin.
public mustRevalidate ( ) : boolean
Результат boolean true if the response must be revalidated by a cache, false otherwise
    public function mustRevalidate()
    {
        return $this->headers->hasCacheControlDirective('must-revalidate') || $this->headers->hasCacheControlDirective('proxy-revalidate');
    }

Usage Example

Пример #1
0
 public function track(Request $request)
 {
     $this->request = $request;
     $referer = $this->request->query->get('utmr', '');
     $path = $this->request->query->get('utmp', '');
     $account = $this->request->query->get('utmac');
     $userAgent = $this->request->server->get('HTTP_USER_AGENT', '');
     $visitorId = $this->request->cookies->get($this->cookieName);
     if (empty($visitorId)) {
         $visitorId = $this->getVisitorId($this->getGuidHeader(), $account, $userAgent);
     }
     $url = $this->constructGifUrl($referer, $path, $account, $visitorId, $this->maskVisitorIp());
     $this->browser->get($url, array('Accept-Language: ' . $this->request->server->get('HTTP_ACCEPT_LANGUAGE'), 'User-Agent: ' . $userAgent));
     $cookie = new Cookie($this->cookieName, $visitorId, time() + $this->cookiePersistence, $this->cookiePath, $this->request->getHost());
     $response = new Response();
     $response->headers->add(array('Content-Type' => 'image/gif', 'Pragma' => 'no-cache'));
     $response->setPrivate();
     $response->mustRevalidate();
     $response->setExpires(new \DateTime('-10 year'));
     $response->setContent(join($this->gifData));
     $response->headers->setCookie($cookie);
     return $response;
 }
All Usage Examples Of Symfony\Component\HttpFoundation\Response::mustRevalidate