Bluz\Http\CacheControl::setClientTtl PHP Method

setClientTtl() public method

This method adjusts the Cache-Control/max-age directive.
public setClientTtl ( integer $seconds ) : void
$seconds integer Number of seconds
return void
    public function setClientTtl($seconds)
    {
        $this->setMaxAge($this->getAge() + $seconds);
    }

Usage Example

Example #1
0
 /**
  * Test Client Ttl
  */
 public function testClientTtl()
 {
     $this->cacheControl->setClientTtl(3600);
     $this->assertEquals(3600, $this->cacheControl->getTtl());
     $this->assertEquals(3600, $this->cacheControl->getMaxAge());
     $this->assertEquals('max-age=3600', $this->response->getHeader('Cache-Control'));
 }