예제 #1
0
 /**
  * Run a bunch of URLs through SquidUpdate::purge()
  * to benchmark Squid response times.
  * @param array $urls A bunch of URLs to purge
  * @param int $trials How many times to run the test?
  * @return string
  */
 private function benchSquid($urls, $trials = 1)
 {
     $start = microtime(true);
     for ($i = 0; $i < $trials; $i++) {
         CdnCacheUpdate::purge($urls);
     }
     $delta = microtime(true) - $start;
     $pertrial = $delta / $trials;
     $pertitle = $pertrial / count($urls);
     return sprintf("%4d titles in %6.2fms (%6.2fms each)", count($urls), $pertrial * 1000.0, $pertitle * 1000.0);
 }
예제 #2
0
 public function run()
 {
     // Use purge() directly to avoid infinite recursion
     CdnCacheUpdate::purge($this->params['urls']);
     return true;
 }