Skip to content

Commit

Permalink
formatting and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Jan 21, 2020
1 parent c2b7178 commit 8683a3d
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/Illuminate/Cache/RedisLock.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,9 @@ public function __construct($redis, $name, $seconds, $owner = null)
public function acquire()
{
if ($this->seconds > 0) {
// Use the atomic operations EX NX to avoid deadlock (Redis version >= 2.6.12)
$result = $this->redis->set($this->name, $this->owner, 'EX', $this->seconds, 'NX');

return $result == 'OK';
return $this->redis->set($this->name, $this->owner, 'EX', $this->seconds, 'NX') == true;
} else {
$result = $this->redis->setnx($this->name, $this->owner);

return $result === 1;
return $this->redis->setnx($this->name, $this->owner) === 1;
}
}

Expand Down

0 comments on commit 8683a3d

Please sign in to comment.