public function clear($check)
    {
        if (!$this->_init) {
            return false;
        }
        $this->_File = null;

        $threshold = $now = false;
        if ($check) {
            $now = time();
            $threshold = $now - $this->_config['duration'];
        }

        $this->_clearDirectory($this->_config['path'], $now, $threshold);

        $directory = new RecursiveDirectoryIterator(
            $this->_config['path'],
            \FilesystemIterator::SKIP_DOTS
        );
        $contents = new RecursiveIteratorIterator(
            $directory,
            RecursiveIteratorIterator::SELF_FIRST
        );
        $cleared = [];
        foreach ($contents as $path) {
            if ($path->isFile()) {
                continue;
            }

            $path = $path->getRealPath() . DIRECTORY_SEPARATOR;
            if (!in_array($path, $cleared)) {
                $this->_clearDirectory($path, $now, $threshold);
                $cleared[] = $path;
            }
        }

        return true;
    }
public function clear($check)
    {
        if (!$this->_init) {
            return false;
        }
        $this->_File = null;

        $threshold = $now = false;
        if ($check) {
            $now = time();
            $threshold = $now - $this->_config['duration'];
        }

        $this->_clearDirectory($this->_config['path'], $now, $threshold);

        $directory = new RecursiveDirectoryIterator(
            $this->_config['path'],
            \FilesystemIterator::SKIP_DOTS
        );
        $contents = new RecursiveIteratorIterator(
            $directory,
            RecursiveIteratorIterator::SELF_FIRST
        );
        $cleared = [];
        foreach ($contents as $path) {
            if ($path->isFile()) {
                continue;
            }

            $path = $path->getRealPath() . DIRECTORY_SEPARATOR;
            if (!in_array($path, $cleared)) {
                $this->_clearDirectory($path, $now, $threshold);
                $cleared[] = $path;
            }
        }

        return true;
    }
public function clear ( $ check ) { if ( ! $ this -> _init ) { return false ; } $ this -> _File = null ; $ threshold = $ now = false ; if ( $ check ) { $ now = time ( ) ; $ threshold = $ now - $ this -> _config [ 'duration' ] ; } $ this -> _clearDirectory ( $ this -> _config [ 'path' ] , $ now , $ threshold ) ; $ directory = new RecursiveDirectoryIterator ( $ this -> _config [ 'path' ] , \ FilesystemIterator :: SKIP_DOTS ) ; $ contents = new RecursiveIteratorIterator ( $ directory , RecursiveIteratorIterator :: SELF_FIRST ) ; $ cleared = [ ] ; foreach ( $ contents as $ path ) { if ( $ path -> isFile ( ) ) { continue ; } $ path = $ path -> getRealPath ( ) . DIRECTORY_SEPARATOR ; if ( ! in_array ( $ path , $ cleared ) ) { $ this -> _clearDirectory ( $ path , $ now , $ threshold ) ; $ cleared [ ] = $ path ; } } return true ; }
Delete all values from the cache

@param bool $check Optional - only delete expired cache items
@return bool True if the cache was successfully cleared, false otherwise
Delete all values from the cache