/**
  * Invalidate cache on $mediaId
  * 
  * @param MediaInterface $media
  */
 protected function invalidate($media)
 {
     $tags = array($this->tagManager->formatMediaIdTag($media->getId()));
     $nodeUsage = $media->getUseReferences(NodeInterface::ENTITY_TYPE);
     foreach ($nodeUsage as $nodeId) {
         $tags[] = $this->tagManager->formatNodeIdTag($nodeId);
     }
     $contentUsage = $media->getUseReferences(ContentInterface::ENTITY_TYPE);
     foreach ($contentUsage as $contentId) {
         $tags[] = $this->tagManager->formatContentIdTag($contentId);
     }
     $contentTypeUsage = $media->getUseReferences(ContentTypeInterface::ENTITY_TYPE);
     foreach ($contentTypeUsage as $contentTypeId) {
         $tags[] = $this->tagManager->formatContentTypeTag($contentTypeId);
     }
     $this->cacheableManager->invalidateTags($tags);
 }
 /**
  * @param MediaInterface $media
  * @param array          $expectedReference
  */
 protected function checkMediaReference($media, $expectedReference)
 {
     $references = $media->getUseReferences();
     $this->assertEquals($references, $expectedReference);
 }