private function invalidateDocumentExcerpt(ExtensionBehavior $document)
    {
        if (!$this->cacheManager) {
            return;
        }

        $extensionData = $document->getExtensionsData();
        if (!isset($extensionData['excerpt'])) {
            return;
        }

        $excerpt = $extensionData['excerpt'];

        if (isset($excerpt['tags'])) {
            foreach ($this->tagManager->resolveTagNames($excerpt['tags']) as $tag) {
                $this->cacheManager->invalidateReference('tag', $tag);
            }
        }

        if (isset($excerpt['categories'])) {
            foreach ($excerpt['categories'] as $category) {
                $this->cacheManager->invalidateReference('category', $category);
            }
        }
    }