Skip to content

Commit 774adce

Browse files
committed
Watcher:1、属性类型说明,2、移除发布订阅无关的database
1 parent 13a321d commit 774adce

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

src/Watcher/RedisWatcher.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ class RedisWatcher implements Watcher
1818
{
1919
private Closure $callback;
2020

21-
private $pubRedis;
21+
private Client $pubRedis;
2222

23-
private $subRedis;
23+
private Client $subRedis;
2424

2525
private $channel;
2626
/**
@@ -86,12 +86,7 @@ public function close(): void
8686
*/
8787
private function createRedisClient(array $config): Client
8888
{
89-
$config['host'] = $config['host'] ?? '127.0.0.1';
90-
$config['port'] = $config['port'] ?? 6379;
91-
$config['password'] = $config['password'] ?? '';
92-
$config['database'] = $config['database'] ?? 0;
93-
94-
$redis = new Client('redis://' . $config['host'] . ':' . $config['port']);
89+
$redis = new Client('redis://' . $config['host'] ?? '127.0.0.1' . ':' . $config['port'] ?? 6379);
9590
$redis->auth($config['password'] ?? '');
9691

9792
return $redis;

0 commit comments

Comments
 (0)