Symfony\Component\HttpFoundation\Response::expire PHP Method

expire() public method

Marks the response stale by setting the Age header to be equal to the maximum age of the response.
public expire ( ) : Response
return Response
    public function expire()
    {
        if ($this->isFresh()) {
            $this->headers->set('Age', $this->getMaxAge());
        }

        return $this;
    }

Usage Example

 /**
  * Renders temporary file
  *
  * @return Response
  */
 public function renderTemporaryAction()
 {
     $name = $this->getRequest()->get('name');
     $fileManager = $this->container->get('thrace_media.filemanager');
     $content = $fileManager->getTemporaryFileBlobByName($name);
     $response = new Response($content);
     $response->headers->set('Accept-Ranges', 'bytes');
     $response->headers->set('Content-Length', mb_strlen($content));
     $response->headers->set('Content-Type', $this->getMimeType($content));
     $response->expire();
     return $response;
 }
All Usage Examples Of Symfony\Component\HttpFoundation\Response::expire