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

setTtl() public method

This method adjusts the Cache-Control/s-maxage directive.
public setTtl ( integer $seconds ) : Response
$seconds integer Number of seconds
return Response
    public function setTtl($seconds)
    {
        $this->setSharedMaxAge($this->getAge() + $seconds);

        return $this;
    }

Usage Example

Exemplo n.º 1
0
 public function cachedPageAction(Request $request, Application $app)
 {
     // this will be cached for 10 sec
     $response = new Response($app['twig']->render('page-with-cache.html.twig', array('date' => date('Y-M-d h:i:s'))));
     $response->setTtl(10);
     return $response;
 }
All Usage Examples Of Symfony\Component\HttpFoundation\Response::setTtl