public function purge()
{
if ($this->isDisabled) {
return false;
}
try {
$results = $this->getDriver()->purge();
} catch (\Exception $e) {
$this->isDisabled = true;
$this->logException('Purging Cache Pool caused exception.', $e);
return false;
}
return $results;
}
public function testPurge() { $pool = new Pool(); $pool->setDriver(new DriverExceptionStub()); $item = $pool->getItem('test'); $this->assertFalse($item->isDisabled()); $this->assertFalse($pool->purge()); $item = $pool->getItem('test'); $this->assertTrue($item->isDisabled(), 'Is disabled after exception is thrown in driver'); $this->assertFalse($pool->purge()); }