You are here

public function FileSystemBackend::delete in File Cache 8

Deletes an item from the cache.

If the cache item is being deleted because it is no longer "fresh", you may consider using invalidate() instead. This allows callers to retrieve the invalid item by calling get() with $allow_invalid set to TRUE. In some cases an invalid item may be acceptable rather than having to rebuild the cache.

Parameters

string $cid: The cache ID to delete.

Overrides CacheBackendInterface::delete

See also

\Drupal\Core\Cache\CacheBackendInterface::invalidate()

\Drupal\Core\Cache\CacheBackendInterface::deleteMultiple()

\Drupal\Core\Cache\CacheBackendInterface::deleteAll()

2 calls to FileSystemBackend::delete()
FileSystemBackend::deleteMultiple in src/Cache/FileSystemBackend.php
Deletes multiple items from the cache.
FileSystemBackend::garbageCollection in src/Cache/FileSystemBackend.php
Performs garbage collection on a cache bin.

File

src/Cache/FileSystemBackend.php, line 168

Class

FileSystemBackend
A cache backend that stores cache items as files on the file system.

Namespace

Drupal\filecache\Cache

Code

public function delete($cid) {
  $filename = $this
    ->getFilename($cid);
  if (is_file($filename)) {
    $this->fileSystem
      ->unlink($filename);
  }
}