Skip to content

Commit 8c5c6c0

Browse files
committed
[feat] release/forceRelease add the return value
1 parent 2d26f27 commit 8c5c6c0

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/RedisLock.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,10 @@ public function acquire()
4040
public function release()
4141
{
4242
if ($this->isOwnedByCurrentProcess()) {
43-
$this->redis->eval(LockScripts::releaseLock(), ['name' => $this->name, 'owner' => $this->owner],1);
43+
$res = $this->redis->eval(LockScripts::releaseLock(), ['name' => $this->name, 'owner' => $this->owner],1);
44+
return $res == 1;
4445
}
46+
return false;
4547
}
4648

4749
/**
@@ -57,6 +59,7 @@ protected function getCurrentOwner()
5759
*/
5860
public function forceRelease()
5961
{
60-
$this->redis->del($this->name);
62+
$r = $this->redis->del($this->name);
63+
return $r == 1;
6164
}
6265
}

0 commit comments

Comments
 (0)