You are here

protected function DrupalCacheAdapter::fetchMetadataKey in Flysystem 8

Same name and namespace in other branches
  1. 3.x src/Flysystem/Adapter/DrupalCacheAdapter.php \Drupal\flysystem\Flysystem\Adapter\DrupalCacheAdapter::fetchMetadataKey()
  2. 2.0.x src/Flysystem/Adapter/DrupalCacheAdapter.php \Drupal\flysystem\Flysystem\Adapter\DrupalCacheAdapter::fetchMetadataKey()
  3. 3.0.x src/Flysystem/Adapter/DrupalCacheAdapter.php \Drupal\flysystem\Flysystem\Adapter\DrupalCacheAdapter::fetchMetadataKey()

Fetches a specific key from metadata.

Parameters

string $path: The path to load metadata for.

string $key: The key in metadata, such as 'mimetype', to load metadata for.

Return value

array The array of metadata.

4 calls to DrupalCacheAdapter::fetchMetadataKey()
DrupalCacheAdapter::getMimetype in src/Flysystem/Adapter/DrupalCacheAdapter.php
DrupalCacheAdapter::getSize in src/Flysystem/Adapter/DrupalCacheAdapter.php
DrupalCacheAdapter::getTimestamp in src/Flysystem/Adapter/DrupalCacheAdapter.php
DrupalCacheAdapter::getVisibility in src/Flysystem/Adapter/DrupalCacheAdapter.php

File

src/Flysystem/Adapter/DrupalCacheAdapter.php, line 265

Class

DrupalCacheAdapter
A Flysystem adapter implementing caching with Drupal's Cache API.

Namespace

Drupal\flysystem\Flysystem\Adapter

Code

protected function fetchMetadataKey($path, $key) {
  $item = $this->cacheItemBackend
    ->load($path);
  if (($metadata = $item
    ->getMetadata()) && isset($metadata[$key])) {
    return $metadata;
  }
  $method = 'get' . ucfirst($key);
  return $this
    ->updateMetadata($path, $this->adapter
    ->{$method}($path));
}