mirror of https://github.com/go-redis/redis.git
Support default redis address
This commit is contained in:
parent
d9c8076236
commit
c9fed25a60
|
@ -24,7 +24,7 @@ func init() {
|
|||
|
||||
func ExampleNewClient() {
|
||||
redisdb := redis.NewClient(&redis.Options{
|
||||
Addr: "localhost:6379",
|
||||
Addr: "localhost:6379", // use default Addr
|
||||
Password: "", // no password set
|
||||
DB: 0, // use default DB
|
||||
})
|
||||
|
|
|
@ -101,6 +101,9 @@ func (opt *Options) init() {
|
|||
if opt.Network == "" {
|
||||
opt.Network = "tcp"
|
||||
}
|
||||
if opt.Addr == "" {
|
||||
opt.Addr = "localhost:6379"
|
||||
}
|
||||
if opt.Dialer == nil {
|
||||
opt.Dialer = func() (net.Conn, error) {
|
||||
netDialer := &net.Dialer{
|
||||
|
|
Loading…
Reference in New Issue