mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-26 03:26:57 +08:00
localcache
This commit is contained in:
parent
03e15766ab
commit
c16cd0bf7c
@ -16,6 +16,7 @@ package friend
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"github.com/openimsdk/open-im-server/v3/pkg/common/config"
|
||||||
|
|
||||||
"github.com/OpenIMSDK/tools/tx"
|
"github.com/OpenIMSDK/tools/tx"
|
||||||
|
|
||||||
@ -54,6 +55,11 @@ type friendServer struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func Start(client registry.SvcDiscoveryRegistry, server *grpc.Server) error {
|
func Start(client registry.SvcDiscoveryRegistry, server *grpc.Server) error {
|
||||||
|
|
||||||
|
config.Config.LocalCache.Friend.Topic = "friend"
|
||||||
|
config.Config.LocalCache.Friend.SlotNum = 500
|
||||||
|
config.Config.LocalCache.Friend.SlotSize = 20000
|
||||||
|
|
||||||
// Initialize MongoDB
|
// Initialize MongoDB
|
||||||
mongo, err := unrelation.NewMongo()
|
mongo, err := unrelation.NewMongo()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -16,6 +16,7 @@ package msg
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"github.com/openimsdk/open-im-server/v3/pkg/common/config"
|
||||||
"github.com/openimsdk/open-im-server/v3/pkg/rpccache"
|
"github.com/openimsdk/open-im-server/v3/pkg/rpccache"
|
||||||
|
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
@ -65,6 +66,11 @@ func (m *msgServer) execInterceptorHandler(ctx context.Context, req *msg.SendMsg
|
|||||||
}
|
}
|
||||||
|
|
||||||
func Start(client discoveryregistry.SvcDiscoveryRegistry, server *grpc.Server) error {
|
func Start(client discoveryregistry.SvcDiscoveryRegistry, server *grpc.Server) error {
|
||||||
|
|
||||||
|
config.Config.LocalCache.Friend.Topic = "friend"
|
||||||
|
config.Config.LocalCache.Friend.SlotNum = 500
|
||||||
|
config.Config.LocalCache.Friend.SlotSize = 20000
|
||||||
|
|
||||||
rdb, err := cache.NewRedis()
|
rdb, err := cache.NewRedis()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -82,6 +88,7 @@ func Start(client discoveryregistry.SvcDiscoveryRegistry, server *grpc.Server) e
|
|||||||
userRpcClient := rpcclient.NewUserRpcClient(client)
|
userRpcClient := rpcclient.NewUserRpcClient(client)
|
||||||
groupRpcClient := rpcclient.NewGroupRpcClient(client)
|
groupRpcClient := rpcclient.NewGroupRpcClient(client)
|
||||||
msgDatabase := controller.NewCommonMsgDatabase(msgDocModel, cacheModel)
|
msgDatabase := controller.NewCommonMsgDatabase(msgDocModel, cacheModel)
|
||||||
|
|
||||||
s := &msgServer{
|
s := &msgServer{
|
||||||
Conversation: &conversationClient,
|
Conversation: &conversationClient,
|
||||||
User: &userRpcClient,
|
User: &userRpcClient,
|
||||||
|
@ -110,10 +110,3 @@ func InitConfig(configFolderPath string) error {
|
|||||||
|
|
||||||
return initConfig(&Config.Notification, NotificationFileName, configFolderPath)
|
return initConfig(&Config.Notification, NotificationFileName, configFolderPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo test
|
|
||||||
func init() {
|
|
||||||
Config.LocalCache.Friend.Topic = "friend"
|
|
||||||
Config.LocalCache.Friend.SlotNum = 500
|
|
||||||
Config.LocalCache.Friend.SlotSize = 20000
|
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user