Bluz\Http\CacheControl::setTtl PHP Method

setTtl() public method

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

Usage Example

Example #1
0
 /**
  * Test Ttl
  */
 public function testTtl()
 {
     $this->cacheControl->setTtl(3600);
     $this->assertEquals(3600, $this->cacheControl->getTtl());
     $this->assertEquals(3600, $this->cacheControl->getMaxAge());
     $this->assertEquals('public, s-maxage=3600', $this->response->getHeader('Cache-Control'));
 }