seconds > 0) { return $this->redis->set($this->name, $this->owner, ['nx', 'ex' => $this->seconds]) == true; } else { return $this->redis->setnx($this->name, $this->owner) == true; } } /** * Release the lock. * * @return bool */ public function release() { return (bool) $this->redis->eval(LuaScripts::releaseLock(), [$this->name, $this->owner], 1); } }