Framework Update

This commit is contained in:
2024-01-31 22:15:08 +08:00
parent b5ff5e8b5f
commit 20678a6a0c
1459 changed files with 25954 additions and 16153 deletions
+3 -5
View File
@@ -112,7 +112,7 @@ class CacheDataCollector extends DataCollector implements LateDataCollectorInter
/** @var TraceableAdapterEvent $call */
foreach ($calls as $call) {
++$statistics[$name]['calls'];
$statistics[$name]['time'] += $call->end - $call->start;
$statistics[$name]['time'] += ($call->end ?? microtime(true)) - $call->start;
if ('get' === $call->name) {
++$statistics[$name]['reads'];
if ($call->hits) {
@@ -134,10 +134,8 @@ class CacheDataCollector extends DataCollector implements LateDataCollectorInter
$statistics[$name]['misses'] += $call->misses;
} elseif ('hasItem' === $call->name) {
++$statistics[$name]['reads'];
if (false === $call->result) {
++$statistics[$name]['misses'];
} else {
++$statistics[$name]['hits'];
foreach ($call->result ?? [] as $result) {
++$statistics[$name][$result ? 'hits' : 'misses'];
}
} elseif ('save' === $call->name) {
++$statistics[$name]['writes'];
+1 -1
View File
@@ -1,4 +1,4 @@
Copyright (c) 2016-2022 Fabien Potencier
Copyright (c) 2016-2023 Fabien Potencier
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
+18 -5
View File
@@ -197,8 +197,11 @@ trait RedisTrait
if (!isset($params['redis_sentinel'])) {
break;
}
$sentinel = new \RedisSentinel($host, $port, $params['timeout'], (string) $params['persistent_id'], $params['retry_interval'], $params['read_timeout']);
$extra = [];
if (\defined('Redis::OPT_NULL_MULTIBULK_AS_NULL') && isset($params['auth'])) {
$extra = [$params['auth']];
}
$sentinel = new \RedisSentinel($host, $port, $params['timeout'], (string) $params['persistent_id'], $params['retry_interval'], $params['read_timeout'], ...$extra);
if ($address = $sentinel->getMasterAddrByName($params['redis_sentinel'])) {
[$host, $port] = $address;
@@ -210,7 +213,13 @@ trait RedisTrait
}
try {
@$redis->{$connect}($host, $port, $params['timeout'], (string) $params['persistent_id'], $params['retry_interval'], $params['read_timeout'], ...\defined('Redis::SCAN_PREFIX') ? [['stream' => $params['ssl'] ?? null]] : []);
$extra = [
'stream' => $params['ssl'] ?? null,
];
if (isset($params['auth'])) {
$extra['auth'] = $params['auth'];
}
@$redis->{$connect}($host, $port, $params['timeout'], (string) $params['persistent_id'], $params['retry_interval'], $params['read_timeout'], ...\defined('Redis::SCAN_PREFIX') ? [$extra] : []);
set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; });
try {
@@ -219,7 +228,7 @@ trait RedisTrait
restore_error_handler();
}
if (!$isConnected) {
$error = preg_match('/^Redis::p?connect\(\): (.*)/', $error, $error) ? sprintf(' (%s)', $error[1]) : '';
$error = preg_match('/^Redis::p?connect\(\): (.*)/', $error ?? '', $error) ? sprintf(' (%s)', $error[1]) : '';
throw new InvalidArgumentException(sprintf('Redis connection "%s" failed: ', $dsn).$error.'.');
}
@@ -558,7 +567,11 @@ trait RedisTrait
if (!$redis instanceof \Predis\ClientInterface && 'eval' === $command && $redis->getLastError()) {
$e = new \RedisException($redis->getLastError());
$results = array_map(function ($v) use ($e) { return false === $v ? $e : $v; }, $results);
$results = array_map(function ($v) use ($e) { return false === $v ? $e : $v; }, (array) $results);
}
if (\is_bool($results)) {
return;
}
foreach ($ids as $k => $id) {