MatthiasMullie\Scrapbook\Buffered\Utils\Defer::commit PHP Метод

commit() публичный Метод

When the commit fails, no changes in this transaction will be applied (and those that had already been applied will be undone). False will be returned in that case.
public commit ( ) : boolean
Результат boolean
    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;
    }

Usage Example

Пример #1
0
 /**
  * Commits all deferred updates to real cache.
  * that had already been written to will be deleted.
  *
  * @return bool
  */
 public function commit()
 {
     $this->clear();
     return $this->defer->commit();
 }