This commit is contained in:
2020-09-04 19:10:08 +08:00
parent 4f8db41ca1
commit 075861fdad
3 changed files with 48 additions and 20 deletions
+20 -11
View File
@@ -145,23 +145,32 @@ class Redis extends Pool
}
/**
* @param $name
* @param $time
* @param $client
* @return bool|mixed
* @throws RedisException
* @throws Exception
*/
public function checkCanUse($time, $client)
public function checkCanUse($name, $time, $client)
{
if ($time + 60 * 10 < time()) {
return false;
try {
if ($time + 60 * 10 < time()) {
return $result = false;
}
if (!($client instanceof SRedis)) {
return $result = false;
}
if (!$client->isConnected() || !$client->ping('connect.')) {
return $result = false;
}
return $result = true;
} catch (Exception $exception) {
return $result = false;
} finally {
if (!$result) {
$this->desc($name);
}
}
if (!($client instanceof SRedis)) {
return false;
}
if (!$client->isConnected() || !$client->ping('connect.')) {
return false;
}
return true;
}
public function desc($name)