redis replace go redis

pull/455/head
Gordon 3 years ago committed by Xinwei Xiong(cubxxw-openim)
parent 29f9931a42
commit 6e088f1eb8

@ -26,7 +26,7 @@ type DataBases struct {
mgoSession *mgo.Session
redisPool *redis.Pool
mongoClient *mongo.Client
rdb *go_redis.ClusterClient
rdb *go_redis.Client
}
func key(dbAddress, dbName string) string {
@ -117,12 +117,17 @@ func init() {
)
},
}
DB.rdb = go_redis.NewClusterClient(&go_redis.ClusterOptions{
Addrs: []string{config.Config.Redis.DBAddress},
PoolSize: 100,
Password: config.Config.Redis.DBPassWord,
DB.rdb = go_redis.NewClient(&go_redis.Options{
Addr: config.Config.Redis.DBAddress,
Password: config.Config.Redis.DBPassWord, // no password set
DB: 0, // use default DB
PoolSize: 100, // 连接池大小
})
//DB.rdb = go_redis.NewClusterClient(&go_redis.ClusterOptions{
// Addrs: []string{config.Config.Redis.DBAddress},
// PoolSize: 100,
// Password: config.Config.Redis.DBPassWord,
//})
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
_, err = DB.rdb.Ping(ctx).Result()

Loading…
Cancel
Save