diff --git a/library/think/cache/driver/redis.php b/library/think/cache/driver/redis.php index cbf9c072..ebb46108 100644 --- a/library/think/cache/driver/redis.php +++ b/library/think/cache/driver/redis.php @@ -24,6 +24,7 @@ class Redis protected $options = [ 'host' => '127.0.0.1', 'port' => 6379, + 'password' => '', 'timeout' => false, 'expire' => 0, 'persistent' => false, @@ -48,6 +49,9 @@ class Redis false === $this->options['timeout'] ? $this->handler->$func($this->options['host'], $this->options['port']) : $this->handler->$func($this->options['host'], $this->options['port'], $this->options['timeout']); + if ('' != $this->options['password']) { + $this->handler->auth($this->options['password']); + } } /**