Neos\Flow\Http\Headers::removeCacheControlDirective PHP Метод

removeCacheControlDirective() публичный Метод

Removes a special directive previously set for the Cache-Control header.
public removeCacheControlDirective ( string $name ) : void
$name string Name of the directive, for example "public"
Результат void
    public function removeCacheControlDirective($name)
    {
        switch ($name) {
            case 'public':
            case 'private':
            case 'no-cache':
                $this->cacheDirectives['visibility'] = '';
                break;
            case 'no-store':
            case 'max-age':
            case 's-maxage':
            case 'no-transform':
            case 'must-revalidate':
            case 'proxy-revalidate':
                $this->cacheDirectives[$name] = '';
                break;
        }
    }

Usage Example

 /**
  * (RFC 2616 / 14.9.4)
  *
  * @test
  */
 public function mustRevalidateAndProxyRevalidateAreRenderedCorrectly()
 {
     $headers = new Headers();
     $headers->setCacheControlDirective('must-revalidate');
     $this->assertEquals('must-revalidate', $headers->get('Cache-Control'));
     $headers->removeCacheControlDirective('must-revalidate');
     $headers->setCacheControlDirective('proxy-revalidate');
     $this->assertEquals('proxy-revalidate', $headers->get('Cache-Control'));
 }