Flush the entire cache or a cache section.

@param string $pSection
@return File
778017
public function flush($pSection = '')
    {
        if ($pSection) {
            $file = $this->_getFilePath($pSection);
            FileData::delete($file);

            if (array_key_exists($file, $this->_files)) {
                unset($this->_files[$file]);
            }

            $path = realpath(dirname($file));
            for ($i = 0; $i < self::SUB_DIRS; $i++) {
                $current = $path;
                $path    = realpath($path . '/../');
                if (count(glob($current . '/*')) === 0) {
                    DirecoryData::delete($current);
                }
            }
        } else {
            DirecoryData::deleteRecursive($this->_dir);
            $this->_files = array();
        }

        return $this;
    }
363758
public function writeCachedContent($content)
    {
        return $this->smarty->ext->_updateCache->writeCachedContent($this->cached, $this, $content);
    }
1335092
public function flushCache()
    {
        if (method_exists(app()->make('cache')->getStore(), 'tags')) {
            app()->make('cache')->tags($this->tag)->flush();

            event(implode('-', $this->tag).'.entity.cache.flushed', [$this]);
        }

        return $this;
    }
359617
public static function flush()
    {
        $instance = self::getInstance();
        $glob = @glob(self::cacheDir() . $instance->_options['file_name_prefix'] . '--*');

        if (empty($glob)) {
            return false;
        }

        foreach ($glob as $v) {
            $fileName = basename($v);
            $id = $instance->_fileNameToId($fileName);
            $instance->delete($id);
        }
        return true;
    }
988084
public function writeCache()
    {
        $this->getFileSystem()->put($this->getCachePath(), $this->serializedInformationForCache($this->information));

        return $this;
    }
763593
public function delete_all($section)
	{
		// determine the section index name
		$section = $this->config['cache_id'].(empty($section)?'':'.'.$section);

		// get the directory index
		$index = apc_fetch($this->config['cache_id'].'__DIR__');

		if (is_array($index))
		{
			// limit the delete if we have a valid section
			if ( ! empty($section))
			{
				$dirs = in_array($section, $index) ? array($section) : array();
			}
			else
			{
				$dirs = $index;
			}

			// loop through the indexes, delete all stored keys, then delete the indexes
			foreach ($dirs as $dir)
			{
				$list = apc_fetch($dir);
				foreach ($list as $item)
				{
					apc_delete($item[0]);
				}
				apc_delete($dir);
			}

			// update the directory index
			$index = array_diff($index, $dirs);
			apc_store($this->config['cache_id'].'__DIR__', $index);
		}
	}
277783
public function getCachedFile($cacheKey) {

        // Get directory and filename
        list($directory, $filename) = $this->getDirectoryAndFilenameFromKey($cacheKey);

        if (file_exists($directory . "/" . $filename) && !is_dir($directory . "/" . $filename)) {
            return file_get_contents($directory . "/" . $filename);
        }

        return null;


    }
509076
public function flushCacheState(bool $force = false): void
    {
        if ((!empty($this->newCacheState) && is_writable($this->cacheDir)) || $force) {
            $fullCacheMap = $this->newCacheState + $this->cacheState;
            $cachePath    = substr(var_export($this->cacheDir, true), 1, -1);
            $rootPath     = substr(var_export($this->appDir, true), 1, -1);
            $cacheData    = '<?php return ' . var_export($fullCacheMap, true) . ';';
            $cacheData    = strtr($cacheData, [
                '\'' . $cachePath => 'AOP_CACHE_DIR . \'',
                '\'' . $rootPath  => 'AOP_ROOT_DIR . \''
            ]);
            $fullCacheFileName = $this->cacheDir . self::CACHE_FILE_NAME;
            file_put_contents($fullCacheFileName, $cacheData, LOCK_EX);
            // For cache files we don't want executable bits by default
            chmod($fullCacheFileName, $this->fileMode & (~0111));

            if (function_exists('opcache_invalidate')) {
                opcache_invalidate($fullCacheFileName, true);
            }
            $this->cacheState    = $this->newCacheState + $this->cacheState;
            $this->newCacheState = [];
        }
    }
156425
public function flush($encode = true)
    {
        $this->_ensureReadable(false);
        $content = stream_get_contents($this->_resource);
        return $encode && $this->_encoding ? Mime::encode($content, $this->_encoding) : $content;
    }
1312370
public function delete_all($section)
	{
		// get the cache root path and prep the requested section
		$path = rtrim(static::$path, '\\/').DS;
		$section = $section === null ? '' : static::identifier_to_path($section).DS;

		// if the path does not exist, bail out immediately
		if ( ! is_dir($path.$section))
		{
			return true;
		}

		// get all files in this section
		$files = \File::read_dir($path.$section, -1, array('\.cache$' => 'file'));

		// closure to recusively delete the files
		$delete = function($folder, $files) use(&$delete, $path)
		{
			$folder = rtrim($folder, '\\/').DS;

			foreach ($files as $dir => $file)
			{
				if (is_numeric($dir))
				{
					if ( ! $result = \File::delete($folder.$file))
					{
						return $result;
					}
				}
				else
				{
					if ( ! $result = ($delete($folder.$dir, $file)))
					{
						return $result;
					}
				}
			}

			// if we're processing a sub directory
			if ($folder != $path)
			{
				// remove the folder if no more files are left
				$files = \File::read_dir($folder);
				empty ($files) and rmdir($folder);
			}

			return true;
		};

		return $delete($path.$section, $files);
	}
1121657
public function flush()
    {
        $this->buffer = array_merge($this->cache, $this->buffer);

        return file_put_contents($this->options->get('store'), json_encode($this->buffer));
    }
869052
public function flush()
    {
        if (file_exists($this->CacheFolder . "/" . $this->CacheIndex)) {
            unlink($this->CacheFolder . "/" . $this->CacheIndex);
            touch($this->CacheFolder . "/" . $this->CacheIndex);
        }
        if (file_exists($this->CacheFolder . "/" . $this->CacheDB)) {
            unlink($this->CacheFolder . "/" . $this->CacheDB);
            touch($this->CacheFolder . "/" . $this->CacheDB);
        }
    }
86301
public function flushAction()
    {
        $helper = new FlushCatalogueCacheHelper($this->cacheDir);
        $removedCount = $helper();

        $response = [
            'info' => sprintf('Looking in %s', $this->cacheDir),
            'message' => sprintf('OK (%d cache items removed)', $removedCount),
        ];

        return new JsonResponse($response);
    }
943915
protected function saveToCache($cacheKey, $content)
    {
        // Create or update the index list containing all cache keys for a given image and filter pairing.
        $indexKey = $this->generateIndexKey($cacheKey);
        if ($this->cache->contains($indexKey)) {
            $index = (array) $this->cache->fetch($indexKey);

            if (!\in_array($cacheKey, $index, true)) {
                $index[] = $cacheKey;
            }
        } else {
            $index = [$cacheKey];
        }

        /*
         * Only save the content, if the index has been updated successfully.
         * This is required to have a (hopefully) synchron state between cache and backend.
         *
         * "Hopefully" because there are caches (like Memcache) which will remove keys by themselves.
         */
        if ($this->cache->save($indexKey, $index)) {
            return $this->cache->save($cacheKey, $content);
        }

        return false;
    }
518372
public function reset($string, $flush = false, $cacheKey = '') {
        $this->_errors = array();
        $this->_nodes = array();
        $this->_blacklist = array();
        $this->_whitelist = array();
        $this->_parsed = '';
        $this->_stripped = '';
        $this->_string = $this->escapeHtml($string);
        $this->_cacheKey = $cacheKey;

        if ($flush) {
            $this->resetFilters();
            $this->resetHooks();
            $this->_paths = array();
        }

        return $this;
    }
1017185
public function flush()
    {
        $output = $this->getXml()->flush();
        fwrite($this->resource, $output);
        return $this;
    }
254938
public function write_cache($cache_path, $content)
    {
        $cache_content = json_encode($content);
        $cache_size = strlen($cache_content);

        $temp = tempnam($this->params['path'], 'temp');
        if (!($f = @fopen($temp, 'wb'))) { 
            $temp = $this->params['path'].'/'.uniqid('temp'); 
            if (!($f = @fopen($temp, 'wb'))) { 
                throw new WriteException('Unable to write temporary file '.$temp);
            }
        }

        fwrite($f, $cache_content); 
        fclose($f); 

        if (!rename($temp, $cache_path)) { 
            unlink($cache_path); 
            rename($temp, $cache_path); 
        } 

        chmod($cache_path, $this->params['write_perms']); 

        return $cache_size;
    }