public __construct ( $name, integer $timeout = 3 ) | ||
$timeout | integer | The time in seconds a lock expires, default is 3. |
public function __construct($name, $timeout = 3)
{
$this->timeout = $timeout;
$this->loop = new Loop($this->timeout);
$this->key = static::PREFIX . $name;
}
/** * Sets the Redis APIs. * * @param array $redisAPIs The Redis APIs. * @param string $name The lock name. * @param int $timeout The time in seconds a lock expires, default is 3. * * @throws \LengthException The timeout must be greater than 0. */ public function __construct(array $redisAPIs, $name, $timeout = 3) { parent::__construct($name, $timeout); $this->redisAPIs = $redisAPIs; $this->logger = new NullLogger(); $this->seedRandom(); }