This commit is contained in:
2024-05-01 02:02:58 +08:00
parent 3fc1b16f33
commit c7e0cd4948
+5 -5
View File
@@ -133,7 +133,7 @@ SCRIPT;
*/ */
public function destroy(): void public function destroy(): void
{ {
$this->pool()->close($this->host); $this->pool()->close('mysql.' . $this->host);
} }
@@ -152,7 +152,7 @@ SCRIPT;
return trigger_print_error(throwable($throwable)); return trigger_print_error(throwable($throwable));
} finally { } finally {
if ($client->ping('h') == 'h') { if ($client->ping('h') == 'h') {
$this->pool()->push($this->host, $client); $this->pool()->push('mysql.' . $this->host, $client);
} }
} }
} }
@@ -164,7 +164,7 @@ SCRIPT;
*/ */
private function getClient(): \Redis private function getClient(): \Redis
{ {
return $this->pool()->get($this->host); return $this->pool()->get('mysql.' . $this->host);
} }
@@ -175,8 +175,8 @@ SCRIPT;
protected function pool(): Pool protected function pool(): Pool
{ {
$pool = Kiri::getPool(); $pool = Kiri::getPool();
if (!$pool->hasChannel($this->host)) { if (!$pool->hasChannel('mysql.' . $this->host)) {
$pool->created($this->host, $this->pool['max'], [$this, 'connect']); $pool->created('mysql.' . $this->host, $this->pool['max'], [$this, 'connect']);
} }
return $pool; return $pool;
} }