PHPDaemon\Clients\Redis\Lock::acquire PHP Method

acquire() public method

public acquire ( callable $cb ) : this
$cb callable
return this
    public function acquire($cb)
    {
        Crypt::randomString(16, null, function ($token) use($cb) {
            $this->token = $token;
            $this->pool->set($this->key, $this->token, 'NX', 'EX', $this->timeout, function ($redis) use($cb) {
                $cb($this, $redis->result === 'OK', $redis);
            });
        });
        return $this;
    }