This commit is contained in:
2021-06-04 18:11:58 +08:00
parent 894feb3506
commit 1622986699
+6 -10
View File
@@ -137,10 +137,14 @@ SCRIPT;
{ {
$connections = Snowflake::app()->getRedisFromPool(); $connections = Snowflake::app()->getRedisFromPool();
$client = $connections->get($this->get_config(), true); $config = $this->get_config();
$client = $connections->get($config, true);
if (!($client instanceof \Redis)) { if (!($client instanceof \Redis)) {
throw new Exception('Redis connections more.'); throw new Exception('Redis connections more.');
} }
$client->select($client['databases']);
$client->_prefix($client['prefix']);
return $client; return $client;
} }
@@ -150,15 +154,7 @@ SCRIPT;
*/ */
public function get_config(): array public function get_config(): array
{ {
return Config::get('cache.redis', false, [ return Config::get('cache.redis', null, true);
'host' => '127.0.0.1',
'port' => '6379',
'prefix' => Config::get('id'),
'auth' => '',
'databases' => '0',
'read_timeout' => -1,
'timeout' => -1,
]);
} }
} }