You are here

public function FileMetadataManager::deleteCachedMetadata in File metadata manager 8.2

Same name and namespace in other branches
  1. 8 src/FileMetadataManager.php \Drupal\file_mdm\FileMetadataManager::deleteCachedMetadata()

Deletes the all the cached metadata for the URI.

Parameters

string $uri: The URI to a file.

Return value

bool TRUE if the cached metadata was removed, FALSE in case of error.

Overrides FileMetadataManagerInterface::deleteCachedMetadata

File

src/FileMetadataManager.php, line 139

Class

FileMetadataManager
A service class to provide file metadata.

Namespace

Drupal\file_mdm

Code

public function deleteCachedMetadata($uri) {
  if (!($hash = $this
    ->calculateHash($uri))) {
    return FALSE;
  }
  foreach (array_keys($this->pluginManager
    ->getDefinitions()) as $plugin_id) {
    $this->cache
      ->delete("hash:{$plugin_id}:{$hash}");
  }
  return TRUE;
}