You are here

public function CacheItemBackend::load in Flysystem 8

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

Loads a cache item for a given path.

Parameters

string $path: The path of the item to load.

Return value

\Drupal\flysystem\Flysystem\Adapter\CacheItem The cache item, or a new cache item if one isn't in the cache.

File

src/Flysystem/Adapter/CacheItemBackend.php, line 64

Class

CacheItemBackend
Storage backend for cache items.

Namespace

Drupal\flysystem\Flysystem\Adapter

Code

public function load($path) {
  $key = $this
    ->getCacheKey($path);
  if ($cached = $this->cacheBackend
    ->get($key)) {

    /** @var \Drupal\flysystem\Flysystem\Adapter\CacheItem $item */
    $item = $cached->data;
  }
  else {
    $item = new CacheItem();
  }
  return $item;
}