Neos\Cache\Backend\SimpleFileBackend::remove PHP Méthode

remove() public méthode

Usually this only affects one entry.
public remove ( string $entryIdentifier ) : boolean
$entryIdentifier string Specifies the cache entry to remove
Résultat boolean TRUE if (at least) an entry could be removed or FALSE if no entry was found
    public function remove($entryIdentifier)
    {
        if ($entryIdentifier !== basename($entryIdentifier)) {
            throw new \InvalidArgumentException('The specified entry identifier must not contain a path segment.', 1334756960);
        }
        if ($entryIdentifier === '') {
            throw new \InvalidArgumentException('The specified entry identifier must not be empty.', 1334756961);
        }
        $pathAndFilename = $this->cacheDirectory . $entryIdentifier . $this->cacheEntryFileExtension;
        try {
            $lock = new Lock($pathAndFilename);
            unlink($pathAndFilename);
            $lock->release();
        } catch (\Exception $exception) {
            return false;
        }
        return true;
    }

Usage Example

 /**
  * Removes all cache entries matching the specified identifier.
  * Usually this only affects one entry.
  *
  * @param string $entryIdentifier Specifies the cache entry to remove
  * @return boolean TRUE if (at least) an entry could be removed or FALSE if no entry was found
  * @throws \RuntimeException
  * @throws \InvalidArgumentException
  * @api
  */
 public function remove($entryIdentifier)
 {
     if ($this->frozen === true) {
         throw new \RuntimeException(sprintf('Cannot remove cache entry because the backend of cache "%s" is frozen.', $this->cacheIdentifier), 1323344193);
     }
     return parent::remove($entryIdentifier);
 }