malkusch\lock\mutex\SpinlockMutex::__construct PHP Метод

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

Sets the timeout.
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;
    }

Usage Example

Пример #1
0
 /**
  * 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();
 }
All Usage Examples Of malkusch\lock\mutex\SpinlockMutex::__construct