public function configureCache(FilterResponseEvent $event)
    {
        $view = $event->getRequest()->attributes->get('view');
        if (!$view instanceof CachableView || !$view instanceof TagView) {
            return;
        }

        if (!$this->enableViewCache || !$view->isCacheEnabled()) {
            return;
        }

        $tag = $view->getTag();
        $response = $event->getResponse();

        $response->setPublic();
        $response->headers->set('X-Tag-Id', $tag->id, false);

        if ($this->enableTtlCache && !$response->headers->hasCacheControlDirective('s-maxage')) {
            $response->setSharedMaxAge($this->defaultTtl);
        }
    }
public function configureCache(FilterResponseEvent $event)
    {
        $view = $event->getRequest()->attributes->get('view');
        if (!$view instanceof CachableView || !$view instanceof TagView) {
            return;
        }

        if (!$this->enableViewCache || !$view->isCacheEnabled()) {
            return;
        }

        $tag = $view->getTag();
        $response = $event->getResponse();

        $response->setPublic();
        $response->headers->set('X-Tag-Id', $tag->id, false);

        if ($this->enableTtlCache && !$response->headers->hasCacheControlDirective('s-maxage')) {
            $response->setSharedMaxAge($this->defaultTtl);
        }
    }
public function configureCache ( FilterResponseEvent $ event ) { $ view = $ event -> getRequest ( ) -> attributes -> get ( 'view' ) ; if ( ! $ view instanceof CachableView || ! $ view instanceof TagView ) { return ; } if ( ! $ this -> enableViewCache || ! $ view -> isCacheEnabled ( ) ) { return ; } $ tag = $ view -> getTag ( ) ; $ response = $ event -> getResponse ( ) ; $ response -> setPublic ( ) ; $ response -> headers -> set ( 'X-Tag-Id' , $ tag -> id , false ) ; if ( $ this -> enableTtlCache && ! $ response -> headers -> hasCacheControlDirective ( 's-maxage' ) ) { $ response -> setSharedMaxAge ( $ this -> defaultTtl ) ; } }
Configures the caching headers on tag view.

@param \Symfony\Component\HttpKernel\Event\FilterResponseEvent $event
Configures the caching headers on tag view .