改进Redis驱动支持密码连接

This commit is contained in:
wuyumin
2016-01-01 14:48:49 +08:00
parent 6e5daf265c
commit f4c498d3c3

View File

@@ -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']);
}
}
/**