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

setMaxAge() public method

This methods sets the Cache-Control max-age directive.
public setMaxAge ( integer $value ) : Response
$value integer Number of seconds
return Response
    public function setMaxAge($value)
    {
        $this->headers->addCacheControlDirective('max-age', $value);

        return $this;
    }

Usage Example

Beispiel #1
0
 public function testDisableCache()
 {
     // disable cache
     $this->structure->getCacheLifeTime()->willReturn(0);
     $this->response->setPublic()->shouldNotBeCalled();
     $this->response->setMaxAge($this->maxAge)->shouldNotBeCalled();
     $this->response->setSharedMaxAge($this->sharedMaxAge)->shouldNotBeCalled();
     $this->handler->updateResponse($this->response->reveal(), $this->structure->reveal());
 }
All Usage Examples Of Symfony\Component\HttpFoundation\Response::setMaxAge