Invalidate node cache so hook_node_view() runs on each node view
For new content added to $build you have also add the cache metadata.

Example if you add data from a file entity do this:

$renderer = \Drupal::service('renderer');
$renderer-&gt;addCacheableDependency($build, $file);


This adds the cache tag for the file and whenever this file is changed, the cache item of the node which contains information from the file gets invalidated.

If  the added $content is already a render array with cache metadata drupal will merge this. You can check, which cache tags are missing in $content and add them in the class that generates this data.

Reference: https://www.drupal.org/docs/8/api/render-api/cacheability-of-render-arrays

If what the comment in the code suggests you have a list of files, you can add the tag 'file_list'. All entities invalidate the tag [entity-type]_list when creating, changing or deleting an entity. 

Edit:

If you use the standard tools, that is building single entity displays with the view() method and list of entities with Views, then you don't need to take care of cache dependencies, because the render arrays these tools produce contain all necessary cache metadata.