how to add cache tag in custom rss feed how to add cache tag in custom RSS feed in Drupal 8 
I have tried like this 

    use Symfony\Component\HttpFoundation\Response;
    $response = new Response();
    $xml_content = '&lt;?xml version="1.0" encoding="UTF-8"?&gt;
     &lt;rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"&gt;
      &lt;channel&gt;
       &lt;title&gt;&lt;![CDATA[ Title there ]]&gt;&lt;/title&gt;
       &lt;link&gt;&lt;![CDATA[ siteurl.com ]]&gt;&lt;/link&gt;
       &lt;description&gt;&lt;![CDATA[ description there ]]&gt;&lt;/description&gt;
      &lt;/channel&gt;
     &lt;/rss&gt;';
    $cacheTags = ['node:nid', 'node:nid']
    $response-&gt;setContent($xml_content);
    $response-&gt;setCache(['etag' =&gt; $cacheTags]);
    $response-&gt;headers-&gt;set('Content-Type', 'xml');


but it not working
Add the cache tags to the cacheable metadata of a cacheable response:

use Drupal\Core\Cache\CacheableResponse;

  $response = new CacheableResponse();
  // ...
  $response-&gt;getCacheableMetadata()-&gt;addCacheTags(['node:nid', 'node:nid']);