框架升级及修复升级后的bug
This commit is contained in:
+6
-9
@@ -214,7 +214,7 @@ trait RedisTrait
|
||||
$params['auth'] ??= $auth;
|
||||
$sentinelAuth = null;
|
||||
} elseif (!class_exists(\Predis\Client::class) && !class_exists(\RedisSentinel::class) && !class_exists(Sentinel::class)) {
|
||||
throw new CacheException('Redis Sentinel support requires one of: "predis/predis", "ext-redis >= 6.1", "ext-relay".');
|
||||
throw new CacheException('Redis Sentinel support requires one of: "predis/predis", "ext-redis >= 5.2", "ext-relay".');
|
||||
} else {
|
||||
$sentinelAuth = $params['auth'] ?? null;
|
||||
$params['auth'] = $auth ?? $params['auth'];
|
||||
@@ -254,7 +254,7 @@ trait RedisTrait
|
||||
};
|
||||
|
||||
if (isset($params['sentinel']) && !is_a($class, \Predis\Client::class, true) && !class_exists(\RedisSentinel::class) && !class_exists(Sentinel::class)) {
|
||||
throw new CacheException(\sprintf('Cannot use Redis Sentinel: class "%s" does not extend "Predis\Client" and neither ext-redis >= 6.1 nor ext-relay have been found.', $class));
|
||||
throw new CacheException(\sprintf('Cannot use Redis Sentinel: class "%s" does not extend "Predis\Client" and neither ext-redis >= 5.2 nor ext-relay have been found.', $class));
|
||||
}
|
||||
|
||||
$isRedisExt = is_a($class, \Redis::class, true);
|
||||
@@ -282,7 +282,7 @@ trait RedisTrait
|
||||
}
|
||||
|
||||
try {
|
||||
if ($isRedisExt) {
|
||||
if ($isRedisExt && version_compare(phpversion('redis'), '6.0.0', '>=')) {
|
||||
$options = [
|
||||
'host' => $host,
|
||||
'port' => $port,
|
||||
@@ -343,7 +343,7 @@ trait RedisTrait
|
||||
$redis->setOption($isRedisExt ? \Redis::OPT_TCP_KEEPALIVE : Relay::OPT_TCP_KEEPALIVE, $params['tcp_keepalive']);
|
||||
}
|
||||
|
||||
if (!$redis->select($params['dbindex'])) {
|
||||
if ((!\defined('Redis::SCAN_PREFIX') && null !== $params['auth'] && $isRedisExt && !$redis->auth($params['auth'])) || !$redis->select($params['dbindex'])) {
|
||||
$e = preg_replace('/^ERR /', '', $redis->getLastError());
|
||||
throw new InvalidArgumentException('Redis connection failed: '.$e.'.');
|
||||
}
|
||||
@@ -579,7 +579,7 @@ trait RedisTrait
|
||||
if ($this->redis instanceof RelayCluster) {
|
||||
$prefix = Relay::SCAN_PREFIX & $this->redis->getOption(Relay::OPT_SCAN) ? '' : $this->redis->getOption(Relay::OPT_PREFIX);
|
||||
$prefixLen = \strlen($prefix ?? '');
|
||||
$pattern = $prefix.$namespace.'*';
|
||||
$pattern = addcslashes($prefix.$namespace, '*?[]\\').'*';
|
||||
foreach ($this->redis->_masters() as $ipAndPort) {
|
||||
$address = implode(':', $ipAndPort);
|
||||
$cursor = null;
|
||||
@@ -634,7 +634,7 @@ trait RedisTrait
|
||||
$prefix = \defined('Redis::SCAN_PREFIX') && (\Redis::SCAN_PREFIX & $host->getOption(\Redis::OPT_SCAN)) ? '' : $host->getOption(\Redis::OPT_PREFIX);
|
||||
$prefixLen = \strlen($host->getOption(\Redis::OPT_PREFIX) ?? '');
|
||||
}
|
||||
$pattern = $prefix.$namespace.'*';
|
||||
$pattern = addcslashes($prefix.$namespace, '*?[]\\').'*';
|
||||
|
||||
if (!version_compare($info['redis_version'], '2.8', '>=')) {
|
||||
// As documented in Redis documentation (http://redis.io/commands/keys) using KEYS
|
||||
@@ -726,9 +726,6 @@ trait RedisTrait
|
||||
return $failed;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param-immediately-invoked-callable $generator
|
||||
*/
|
||||
private function pipeline(\Closure $generator, ?object $redis = null): \Generator
|
||||
{
|
||||
$ids = [];
|
||||
|
||||
Reference in New Issue
Block a user