mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-05 09:36:00 +08:00
redis replace go redis
This commit is contained in:
+14
-1
@@ -8,8 +8,8 @@ import (
|
||||
//"Open_IM/pkg/common/log"
|
||||
"Open_IM/pkg/utils"
|
||||
"fmt"
|
||||
go_redis "github.com/go-redis/redis/v8"
|
||||
"go.mongodb.org/mongo-driver/mongo/options"
|
||||
|
||||
// "context"
|
||||
// "fmt"
|
||||
"github.com/garyburd/redigo/redis"
|
||||
@@ -30,6 +30,7 @@ type DataBases struct {
|
||||
mgoSession *mgo.Session
|
||||
redisPool *redis.Pool
|
||||
mongoClient *mongo.Client
|
||||
rdb *go_redis.ClusterClient
|
||||
}
|
||||
|
||||
func key(dbAddress, dbName string) string {
|
||||
@@ -113,6 +114,18 @@ func init() {
|
||||
)
|
||||
},
|
||||
}
|
||||
|
||||
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()
|
||||
if err != nil {
|
||||
panic(err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
func createMongoIndex(client *mongo.Client, collection string, isUnique bool, keys ...string) error {
|
||||
|
||||
Reference in New Issue
Block a user