改名
This commit is contained in:
@@ -11,6 +11,7 @@ namespace Kiri\Cache;
|
|||||||
|
|
||||||
use Annotation\Inject;
|
use Annotation\Inject;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
use Server\Events\OnAfterRequest;
|
||||||
use Server\Events\OnWorkerExit;
|
use Server\Events\OnWorkerExit;
|
||||||
use Server\Events\OnWorkerStop;
|
use Server\Events\OnWorkerStop;
|
||||||
use Kiri\Abstracts\Component;
|
use Kiri\Abstracts\Component;
|
||||||
@@ -48,6 +49,7 @@ class Redis extends Component
|
|||||||
|
|
||||||
$length = Config::get('connections.pool.max', 10);
|
$length = Config::get('connections.pool.max', 10);
|
||||||
|
|
||||||
|
$this->eventProvider->on(OnAfterRequest::class, [$this, 'release'], 0);
|
||||||
$this->eventProvider->on(OnWorkerExit::class, [$this, 'destroy'], 0);
|
$this->eventProvider->on(OnWorkerExit::class, [$this, 'destroy'], 0);
|
||||||
|
|
||||||
$connections->initConnections('Redis:' . $config['host'], true, $length);
|
$connections->initConnections('Redis:' . $config['host'], true, $length);
|
||||||
@@ -67,7 +69,6 @@ class Redis extends Component
|
|||||||
$data = $this->{$name}(...$arguments);
|
$data = $this->{$name}(...$arguments);
|
||||||
} else {
|
} else {
|
||||||
$data = $this->proxy()->{$name}(...$arguments);
|
$data = $this->proxy()->{$name}(...$arguments);
|
||||||
$this->release();
|
|
||||||
}
|
}
|
||||||
if (microtime(true) - $time >= 0.02) {
|
if (microtime(true) - $time >= 0.02) {
|
||||||
$this->warning('Redis:' . Json::encode([$name, $arguments]) . (microtime(true) - $time));
|
$this->warning('Redis:' . Json::encode([$name, $arguments]) . (microtime(true) - $time));
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class Environmental
|
|||||||
/**
|
/**
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
#[Pure] public function isMac(): bool
|
public function isMac(): bool
|
||||||
{
|
{
|
||||||
$output = strtolower(PHP_OS | PHP_OS_FAMILY);
|
$output = strtolower(PHP_OS | PHP_OS_FAMILY);
|
||||||
if (str_contains('mac', $output)) {
|
if (str_contains('mac', $output)) {
|
||||||
|
|||||||
@@ -132,6 +132,7 @@ class Pool extends Component
|
|||||||
* @param $channel
|
* @param $channel
|
||||||
* @return mixed
|
* @return mixed
|
||||||
* @throws ConfigException
|
* @throws ConfigException
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private function maxIdleQuantity($channel): mixed
|
private function maxIdleQuantity($channel): mixed
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user