![image.png](https://static.studygolang.com/191006/699f24a746382c73fb175bdd1106d9e4.png)
查看源码是这样的一个结构:上面的代码怎么初始化一个 go 连接池啊
![image.png](https://static.studygolang.com/191006/82e7407598baadc48e97d986083b0b4b.png)
更多评论
https://github.com/Gourouting/singo/blob/master/cache/main.go
这个项目可以跑起来,里面有redis,你可以参考参考
#1
https://github.com/eehsiao/go-models-redis/blob/master/redis.go
參考
```
import (
"github.com/go-redis/redis"
)
....
cfg = &redis.Options{
Addr: addr,
Password: pw,
DB: db,
PoolSize : active,
MinIdleConns : idle,
}
db = redis.NewClient(cfg)
```
#2