public function testLockMultiple() { $redlock = new RedLock($this->servers); $resource = "my_test_resource" . time(); $lockA = $redlock->lock($resource, 1000); $lockB = $redlock->lock($resource, 1000); $lockC = $redlock->lock($resource, 1000); $this->assertInternalType("array", $lockA); $this->assertFalse($lockB); $this->assertFalse($lockC); $this->assertTrue($redlock->unlock($lockA)); $lockA = $redlock->lock($resource, 1000); $lockB = $redlock->lock($resource, 1000); $this->assertInternalType("array", $lockA); $this->assertFalse($lockB); $this->assertTrue($redlock->unlock($lockA)); }
/** * @param mixed $lock * @return bool * @throws \Exception */ public function unlock($lock) { return $this->redLock->unlock($lock); }