Removes a Cache-Control directive.
public removeCacheControlDirective ( string $key ) | ||
$key | string | The Cache-Control directive |
public function testCacheControlDirectiveAccessors() { $bag = new HeaderBag(); $bag->addCacheControlDirective('public'); $this->assertTrue($bag->hasCacheControlDirective('public')); $this->assertTrue($bag->getCacheControlDirective('public')); $this->assertEquals('public', $bag->get('cache-control')); $bag->addCacheControlDirective('max-age', 10); $this->assertTrue($bag->hasCacheControlDirective('max-age')); $this->assertEquals(10, $bag->getCacheControlDirective('max-age')); $this->assertEquals('max-age=10, public', $bag->get('cache-control')); $bag->removeCacheControlDirective('max-age'); $this->assertFalse($bag->hasCacheControlDirective('max-age')); }
/** * Marks the response as "public". * * It makes the response eligible for serving other clients. */ public function setPublic() { $this->headers->addCacheControlDirective('public'); $this->headers->removeCacheControlDirective('private'); }