0 follower

Trait Yiisoft\Mutex\RetryAcquireTrait

Implemented byYiisoft\Mutex\Mutex

Allows retrying acquire with a certain timeout.

Public Methods

Hide inherited methods

Method Description Defined By
withRetryDelay() Returns a new instance with the specified retry delay. Yiisoft\Mutex\RetryAcquireTrait

Method Details

Hide inherited methods

withRetryDelay() public method

Returns a new instance with the specified retry delay.

public self withRetryDelay ( integer $retryDelay )
$retryDelay integer

Number of milliseconds between each try until specified timeout times out. By default, it is 50 milliseconds - it means that we may try to acquire lock up to 20 times per second.

                public function withRetryDelay(int $retryDelay): self
{
    if ($retryDelay < 1) {
        throw new InvalidArgumentException(
            "Retry delay value must be a positive number greater than zero, \"$retryDelay\" is received.",
        );
    }
    $new = clone $this;
    $new->retryDelay = $retryDelay;
    return $new;
}