public function commit()
{
list($old, $new) = $this->generateRollback();
$updates = $this->generateUpdates();
$updates = $this->combineUpdates($updates);
usort($updates, array($this, 'sortUpdates'));
foreach ($updates as $update) {
// apply update to cache & receive a simple bool to indicate
// success (true) or failure (false)
$success = call_user_func_array($update[1], $update[2]);
if ($success === false) {
$this->rollback($old, $new);
return false;
}
}
$this->clear();
return true;
}