You are here

public function DrupalCacheAdapter::rename in Flysystem 8

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

File

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

Class

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

Namespace

Drupal\flysystem\Flysystem\Adapter

Code

public function rename($path, $newpath) {
  $result = $this->adapter
    ->rename($path, $newpath);
  if ($result) {
    $item = $this->cacheItemBackend
      ->load($path);
    $newitem = clone $item;
    $this->cacheItemBackend
      ->set($newpath, $newitem);
    $this->cacheItemBackend
      ->delete($path);
  }
  return $result;
}