mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-06 04:15:46 +08:00
docker-compose fix
This commit is contained in:
parent
67b20d073e
commit
1b4b2b9bb1
@ -31,6 +31,7 @@ type DataBases struct {
|
|||||||
mongoClient *mongo.Client
|
mongoClient *mongo.Client
|
||||||
rdb go_redis.UniversalClient
|
rdb go_redis.UniversalClient
|
||||||
Rc *rockscache.Client
|
Rc *rockscache.Client
|
||||||
|
WeakRc *rockscache.Client
|
||||||
}
|
}
|
||||||
|
|
||||||
type RedisClient struct {
|
type RedisClient struct {
|
||||||
@ -145,13 +146,23 @@ func init() {
|
|||||||
panic(err.Error())
|
panic(err.Error())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 强一致性缓存,当一个key被标记删除,其他请求线程会被锁住轮询直到新的key生成,适合各种同步的拉取, 如果弱一致可能导致拉取还是老数据,毫无意义
|
||||||
DB.Rc = rockscache.NewClient(go_redis.NewClient(&go_redis.Options{
|
DB.Rc = rockscache.NewClient(go_redis.NewClient(&go_redis.Options{
|
||||||
Addr: config.Config.Redis.DBAddress[0],
|
Addr: config.Config.Redis.DBAddress[0],
|
||||||
Password: config.Config.Redis.DBPassWord, // no password set
|
Password: config.Config.Redis.DBPassWord, // no password set
|
||||||
DB: 0, // use default DB
|
DB: 0, // use default DB
|
||||||
PoolSize: 100, // 连接池大小
|
PoolSize: 100, // 连接池大小
|
||||||
}), rockscache.NewDefaultOptions())
|
}), rockscache.NewDefaultOptions())
|
||||||
|
DB.Rc.Options.StrongConsistency = true
|
||||||
|
|
||||||
|
// 弱一致性缓存,当一个key被标记删除,其他请求线程直接返回该key的value,适合高频并且生成很缓存很慢的情况 如大群发消息缓存的缓存
|
||||||
|
DB.WeakRc = rockscache.NewClient(go_redis.NewClient(&go_redis.Options{
|
||||||
|
Addr: config.Config.Redis.DBAddress[0],
|
||||||
|
Password: config.Config.Redis.DBPassWord, // no password set
|
||||||
|
DB: 0, // use default DB
|
||||||
|
PoolSize: 100, // 连接池大小
|
||||||
|
}), rockscache.NewDefaultOptions())
|
||||||
|
DB.WeakRc.Options.StrongConsistency = false
|
||||||
}
|
}
|
||||||
|
|
||||||
func createMongoIndex(client *mongo.Client, collection string, isUnique bool, keys ...string) error {
|
func createMongoIndex(client *mongo.Client, collection string, isUnique bool, keys ...string) error {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user