From 1622986699b8bd8b33ccda64145ce306f68900cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Fri, 4 Jun 2021 18:11:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- System/Cache/Redis.php | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/System/Cache/Redis.php b/System/Cache/Redis.php index 32e2c993..c4228670 100644 --- a/System/Cache/Redis.php +++ b/System/Cache/Redis.php @@ -137,10 +137,14 @@ SCRIPT; { $connections = Snowflake::app()->getRedisFromPool(); - $client = $connections->get($this->get_config(), true); + $config = $this->get_config(); + + $client = $connections->get($config, true); if (!($client instanceof \Redis)) { throw new Exception('Redis connections more.'); } + $client->select($client['databases']); + $client->_prefix($client['prefix']); return $client; } @@ -150,15 +154,7 @@ SCRIPT; */ public function get_config(): array { - return Config::get('cache.redis', false, [ - 'host' => '127.0.0.1', - 'port' => '6379', - 'prefix' => Config::get('id'), - 'auth' => '', - 'databases' => '0', - 'read_timeout' => -1, - 'timeout' => -1, - ]); + return Config::get('cache.redis', null, true); } }