updated-packages

This commit is contained in:
RafficMohammed
2023-01-08 00:13:22 +05:30
parent 3ff7df7487
commit da241bacb6
12659 changed files with 563377 additions and 510538 deletions

View File

@@ -2,9 +2,7 @@
namespace Illuminate\Cache;
use Illuminate\Contracts\Cache\Lock as LockContract;
class RedisLock extends Lock implements LockContract
class RedisLock extends Lock
{
/**
* The Redis factory implementation.
@@ -19,11 +17,12 @@ class RedisLock extends Lock implements LockContract
* @param \Illuminate\Redis\Connections\Connection $redis
* @param string $name
* @param int $seconds
* @param string|null $owner
* @return void
*/
public function __construct($redis, $name, $seconds)
public function __construct($redis, $name, $seconds, $owner = null)
{
parent::__construct($name, $seconds);
parent::__construct($name, $seconds, $owner);
$this->redis = $redis;
}
@@ -35,7 +34,7 @@ class RedisLock extends Lock implements LockContract
*/
public function acquire()
{
$result = $this->redis->setnx($this->name, 1);
$result = $this->redis->setnx($this->name, $this->owner);
if ($result === 1 && $this->seconds > 0) {
$this->redis->expire($this->name, $this->seconds);
@@ -50,7 +49,27 @@ class RedisLock extends Lock implements LockContract
* @return void
*/
public function release()
{
$this->redis->eval(LuaScripts::releaseLock(), 1, $this->name, $this->owner);
}
/**
* Releases this lock in disregard of ownership.
*
* @return void
*/
public function forceRelease()
{
$this->redis->del($this->name);
}
/**
* Returns the owner value written into the driver for this lock.
*
* @return string
*/
protected function getCurrentOwner()
{
return $this->redis->get($this->name);
}
}