Exemplo n.º 1
0
  $clean = $journal->clean(array(Cache::TAGS => array('homepage')));
  if(count($clean) != $rightCount) {
    var_dump(count($clean));
    echo 'cleanTag3 error'."\n";
  }
}

function cleanAll($journal)
{
  $journal->clean(array(Cache::ALL => TRUE));
}

$bench->type('Init');

if($all) {
  $bench->test('SqliteJournal', function() use (&$sj) {$sj = new SqliteJournal(dirname(__FILE__).'/journal.sqlite');});
  $bench->test('FileJournal', function() use (&$fj) {$fj = new FileJournal(dirname(__FILE__));});
}
$bench->test('BtreeFileJournal', function() use (&$bfj) {$bfj = new BtreeFileJournal(dirname(__FILE__));});

$bench->type('1000 inserts');
if($all) {
  $bench->test('SqliteJournal', function() use (&$sj) {insert1000($sj);});
  $bench->test('FileJournal', function() use (&$fj) {insert1000($fj);});
}
$bench->test('BtreeFileJournal', function() use (&$bfj) {insert1000($bfj);});

$bench->type('Clean all');
if($all) {
  $bench->test('SqliteJournal', function() use (&$sj) {cleanTag3($sj, 1000);});
  $bench->test('FileJournal', function() use (&$fj) {cleanTag3($fj, 1000);});