/**
  * Process the _tags request attribute, which is set when using the Tag
  * annotation.
  *
  * - For a safe (GET or HEAD) request, the tags are set on the response.
  * - For a non-safe request, the tags will be invalidated.
  *
  * @param FilterResponseEvent $event
  */
 public function onKernelResponse(FilterResponseEvent $event)
 {
     $request = $event->getRequest();
     $response = $event->getResponse();
     $tags = array();
     // Only set cache tags or invalidate them if response is successful
     if ($response->isSuccessful()) {
         $tags = $this->getAnnotationTags($request);
     }
     $configuredTags = $this->matchRule($request, $response);
     if ($configuredTags) {
         $tags = array_merge($tags, $configuredTags['tags']);
         foreach ($configuredTags['expressions'] as $expression) {
             $tags[] = $this->evaluateTag($expression, $request);
         }
     }
     if ($request->isMethodSafe()) {
         $this->tagHandler->addTags($tags);
         if (HttpKernelInterface::MASTER_REQUEST === $event->getRequestType()) {
             // For safe requests (GET and HEAD), set cache tags on response
             $this->tagHandler->tagResponse($response);
         }
     } elseif (count($tags)) {
         // For non-safe methods, invalidate the tags
         $this->tagHandler->invalidateTags($tags);
     }
 }
 /**
  * @param array $tags
  */
 public function invalidateTags($tags)
 {
     if (!$this->cacheEnabled) {
         return;
     }
     $this->tagHandler->invalidateTags($tags);
 }