Skip to content

Commit

Permalink
Watcher:1、属性类型说明,2、移除发布订阅无关的database
Browse files Browse the repository at this point in the history
  • Loading branch information
Tinywan committed Jun 10, 2022
1 parent 13a321d commit 774adce
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/Watcher/RedisWatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ class RedisWatcher implements Watcher
{
private Closure $callback;

private $pubRedis;
private Client $pubRedis;

private $subRedis;
private Client $subRedis;

private $channel;
/**
Expand Down Expand Up @@ -86,12 +86,7 @@ public function close(): void
*/
private function createRedisClient(array $config): Client
{
$config['host'] = $config['host'] ?? '127.0.0.1';
$config['port'] = $config['port'] ?? 6379;
$config['password'] = $config['password'] ?? '';
$config['database'] = $config['database'] ?? 0;

$redis = new Client('redis://' . $config['host'] . ':' . $config['port']);
$redis = new Client('redis://' . $config['host'] ?? '127.0.0.1' . ':' . $config['port'] ?? 6379);
$redis->auth($config['password'] ?? '');

return $redis;
Expand Down

0 comments on commit 774adce

Please sign in to comment.