how to add cache tag in custom rss feed
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']);