diff --git a/src/RedLock.php b/src/RedLock.php index 201feaf..5f6770a 100644 --- a/src/RedLock.php +++ b/src/RedLock.php @@ -19,7 +19,6 @@ function __construct(array $servers, $retryDelay = 200, $retryCount = 3) $this->retryCount = $retryCount; $this->quorum = min(count($servers), (count($servers) / 2 + 1)); - } public function lock($resource, $ttl) @@ -71,7 +70,7 @@ public function lock($resource, $ttl) return false; } - public function unlock($lock) + public function unlock(array $lock) { $this->initInstances(); $resource = $lock['resource']; @@ -98,7 +97,6 @@ private function initInstances() private function lockInstance($instance, $resource, $token, $ttl) { return $instance->set($resource, $token, ['NX', 'PX' => $ttl]); - } private function unlockInstance($instance, $resource, $token) @@ -109,9 +107,7 @@ private function unlockInstance($instance, $resource, $token) else return 0 end - '; - - + '; return $instance->eval($script, [$resource, $token], 1); } }