SkyPHP/skyphp — pull request #104 by stanistan (2012-07-05 18:36:29+00:00)
Title: Transaction

Much improved `Model::save()` transaction support.

All validation hooks happen inside of a transaction, as well as after save hooks `after_insert`, `before_reload`, `after_update`, `after_delete`.

Not only are all interactions with the DB in a transaction, all interactions with memcache are as well.

For memcache transactions, using `\Sky\MemcacheTransaction` which stores the value that we want to write in cache with a temporary key, and if the transaction is successful, move those values to their permanent keys and delete the temp ones.

If the transaction fails, there is a `\Sky\MemcacheTransaction::$tmp_duration` which defaults to `5 minutes`, temporary keys will be automatically cleaned up.