This commit is contained in:
2021-04-01 18:35:16 +08:00
parent dff7a4ce2b
commit 503e8d98f6
+4 -9
View File
@@ -48,10 +48,8 @@ class Redis extends Component
/** /**
* @throws ComponentException
* @throws ConfigException * @throws ConfigException
* @throws ReflectionException * @throws Exception
* @throws NotFindClassException
*/ */
public function createPool() public function createPool()
{ {
@@ -86,10 +84,10 @@ class Redis extends Component
/** /**
* @param $key * @param $key
* @param int $timeout * @param int $timeout
* @return bool * @return bool|int
* @throws Exception * @throws Exception
*/ */
public function lock($key, $timeout = 5): bool public function lock($key, $timeout = 5): bool|int
{ {
$script = <<<SCRIPT $script = <<<SCRIPT
local _nx = redis.call('setnx',KEYS[1], ARGV[1]) local _nx = redis.call('setnx',KEYS[1], ARGV[1])
@@ -116,10 +114,8 @@ SCRIPT;
/** /**
* @throws ComponentException
* @throws ConfigException * @throws ConfigException
* @throws NotFindClassException * @throws Exception
* @throws ReflectionException
*/ */
public function release() public function release()
{ {
@@ -130,7 +126,6 @@ SCRIPT;
/** /**
* 销毁连接池 * 销毁连接池
* @throws ConfigException * @throws ConfigException
* @throws ComponentException
* @throws Exception * @throws Exception
*/ */
public function destroy() public function destroy()