Differences Between: [Versions 310 and 400] [Versions 39 and 400] [Versions 400 and 401]
(no description)
File Size: | 128 lines (4 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
WithTransaction:: (3 methods):
__construct()
execute()
isTransactionTimeLimitExceeded()
Class: WithTransaction - X-Ref
__construct(callable $callback, array $transactionOptions = []) X-Ref |
param: callable $callback A callback that will be invoked within the transaction param: array $transactionOptions Additional options that are passed to Session::startTransaction |
execute(Session $session) X-Ref |
Execute the operation in the given session This helper takes care of retrying the commit operation or the entire transaction if an error occurs. If the commit fails because of an UnknownTransactionCommitResult error, the commit is retried without re-invoking the callback. If the commit fails because of a TransientTransactionError, the entire transaction will be retried. In this case, the callback will be invoked again. It is important that the logic inside the callback is idempotent. In case of failures, the commit or transaction are retried until 120 seconds from the initial call have elapsed. After that, no retries will happen and the helper will throw the last exception received from the driver. return: void param: Session $session A session object as retrieved by Client::startSession |
isTransactionTimeLimitExceeded($startTime) X-Ref |
Returns whether the time limit for retrying transactions in the convenient transaction API has passed return: bool param: int $startTime The time the transaction was started |