public function purgeOldCache()
    {
        $cache_dir = dirname($this->cache_dir);
        $current = basename($this->cache_dir);
        $count = 0;

        foreach (new \DirectoryIterator($cache_dir) as $file) {
            $dir = $file->getBasename();
            if ($dir === $current || $file->isDot() || $file->isFile()) {
                continue;
            }

            Folder::delete($file->getPathname());
            $count++;
        }

        return $count;
    }
public function purgeOldCache()
    {
        $cache_dir = dirname($this->cache_dir);
        $current = basename($this->cache_dir);
        $count = 0;

        foreach (new \DirectoryIterator($cache_dir) as $file) {
            $dir = $file->getBasename();
            if ($dir === $current || $file->isDot() || $file->isFile()) {
                continue;
            }

            Folder::delete($file->getPathname());
            $count++;
        }

        return $count;
    }
public function purgeOldCache ( ) { $ cache_dir = dirname ( $ this -> cache_dir ) ; $ current = basename ( $ this -> cache_dir ) ; $ count = 0 ; foreach ( new \ DirectoryIterator ( $ cache_dir ) as $ file ) { $ dir = $ file -> getBasename ( ) ; if ( $ dir === $ current || $ file -> isDot ( ) || $ file -> isFile ( ) ) { continue ; } Folder :: delete ( $ file -> getPathname ( ) ) ; $ count ++ ; } return $ count ; }
Deletes the old out of date file-based caches

@return int
Deletes the old out of date file - based caches