Remove a cache file

@param  string $filename
@return boolean
555361
public static function delete($filename)
    {
        if (is_string($filename) && file_exists($filename)) {
            unlink($filename);
            return true;
        }

        return false;
    }
583476
public static function cleanCache(String $fileName = NULL, Bool $real = false)
    {
        $fileName = Info::rpath($fileName);

        if( ! file_exists($fileName) )
        {
            clearstatcache($real);
        }
        else
        {
            clearstatcache($real, $fileName);
        }
    }
291491
protected function removeFile($key)
    {
        $fileKey = $this->getFileKey($key);
        $storage = $this->getStorage($fileKey->getStorageName());
        
        return $storage->getFilesystem()->delete($this->getStoragePath($storage, $fileKey));
    }
860418
public function DeleteChacheFile($filename) {
    if (preg_match('/^\/CURL_RESPON-[0-9a-f]{40}\.\d+$/', $filename)) {
      $filename = $this->CacheDir . $filename;
      if (file_exists($filename)) {
        unlink($filename);
      }
    }
  }
962129
public function deleteFileByName($filename)
    {
        $destinationPath = $this->getDestinationPath();
        $destination = $destinationPath . '/' . $filename;

        if (file_exists($destination)) {
            $files = $this->getFiles();
            foreach ($files as $key => $file) {
                if ($file->file == $filename) {
                    unlink($destination);
                    unset($files[$key]);
                }
            }

            $files = array_values($files);
            $this->repository->files = $files;
            $this->save();
        }
    }
458000
public function deleteImageByName($filename)
    {
        $destinationPath = $this->getDestinationPath();

        $images = $this->getImages();

        foreach ($images as $key => $image) {
            if ($image->file == $filename) {
                foreach ($image->set as $imageSetFilename) {
                    $destination = $destinationPath . '/' . $imageSetFilename;
                    if (file_exists($destination)) {
                        unlink($destination);
                    }
                }
                unset($images[$key]);
            }
        }
        $images = array_values($images);
        $this->repository->images = $images;
        $this->save();
    }
624130
protected function getCache($cachename){
        $file = $this->cachedir . $cachename . '.cache';
        if (!is_file($file)) {
           return false;
        }
        $data = unserialize(file_get_contents( $file ));
        if (!is_array($data) || !isset($data['value']) || (!empty($data['value']) && $data['expired']<time())) {
            @unlink($file);
            return false;
        }
        return $data['value'];
    }
633049
public function removeCache(string $name)
  {
    # Sanity check
    if (empty($name)) return false;

    $cache = $this->findCache($name);

    if ($cache) {
      unset( $this->caches[\strtolower($cache->getDriver())] );
      unset($cache);
      $cache = null;
    }

    return $this;
  }
806837
public function forget($key)
    {
        try {
            unlink($this->getCacheFile($key));
        } catch (Exception $e) {
            return false;
        }

        return true;
    }
625021
public function purge($key)
    {
        $cacheFile = $this->getCachePath($key);

        clearstatcache(true, $cacheFile);
        if (file_exists($cacheFile)) {
            unset($cacheFile);

            return true;
        }

        return false;
    }
965554
public static function removeFromCache($key)
    {
        $fullKey = static::makeCacheKey($key);
        if (!Cache::forget($fullKey)) {
            return false;
        }

        static::removeKeys($key);

        return true;
    }
965193
protected function _removeFile($file)
    {
        $_file = new File($file);

        if ($_file->exists()) {
            $_file->delete();

            $folder = $_file->folder();
            if (count($folder->find()) === 0) {
                $folder->delete();
            }
            return true;
        }
        return false;
    }
575887
public function delete($key)
    {
        $cache_file = $this->path($key);
        if (file_exists($cache_file)) {
            $unlink_result = unlink($cache_file);
            if ($unlink_result === false) return false;
        }

        return true;
    }
29434
public function remove($key)
    {
        $file = $this->getFileName($key);

        if ( !file_exists($file) )
        {
            return false;
        }

        unset(static::$keys[$key]);

        return (unlink($file))? true : false;
    }
702948
protected function cleanFilename($filename)
    {
        /** @var FileIDHelper $helper */
        $helper = Injector::inst()->get(HashFileIDHelper::class);
        return $helper->cleanFilename($filename);
    }
1363449
public static function CacheReady($CacheName) {
      if (!array_key_exists($CacheName,self::$Caches))
         return FALSE;
         
      if (!sizeof(self::$Caches[$CacheName]['cache']))
         return FALSE;
         
      return TRUE;
   }
737997
public static function fileExists($fileName)
    {
        $fp = @fopen($fileName, 'r', true);
        if (is_resource($fp)) {
            fclose($fp);
            return true;
        }
        return false;
    }