public function clearCache($olderThan = - 1)
    {
        $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->getCacheDir()), \RecursiveIteratorIterator::SELF_FIRST);
        $expired  = time() - $olderThan;
        $count    = 0;
        foreach ($iterator as $file) {
            if ($file->isFile() && $file->getCTime() < $expired) {
                $count += unlink((string)$file) ? 1 : 0;
            }
        }

        return $count;
    }
public function clearCache($olderThan = - 1)
    {
        $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->getCacheDir()), \RecursiveIteratorIterator::SELF_FIRST);
        $expired  = time() - $olderThan;
        $count    = 0;
        foreach ($iterator as $file) {
            if ($file->isFile() && $file->getCTime() < $expired) {
                $count += unlink((string)$file) ? 1 : 0;
            }
        }

        return $count;
    }
public function clearCache ( $ olderThan = - 1 ) { $ iterator = new \ RecursiveIteratorIterator ( new \ RecursiveDirectoryIterator ( $ this -> getCacheDir ( ) ) , \ RecursiveIteratorIterator :: SELF_FIRST ) ; $ expired = time ( ) - $ olderThan ; $ count = 0 ; foreach ( $ iterator as $ file ) { if ( $ file -> isFile ( ) && $ file -> getCTime ( ) < $ expired ) { $ count += unlink ( ( string ) $ file ) ? 1 : 0 ; } } return $ count ; }
Clears the cached templates if they are older than the given time.

@param int $olderThan minimum time (in seconds) required for a cached template to be cleared

@return int the amount of templates cleared
Clears the cached templates if they are older than the given time .