This commit is contained in:
wangchuxiao 2022-09-01 21:58:53 +08:00
parent 1d0d063a6c
commit b401917c19
2 changed files with 5 additions and 3 deletions

View File

@ -3,16 +3,17 @@ package cache
import ( import (
"Open_IM/pkg/common/config" "Open_IM/pkg/common/config"
"Open_IM/pkg/common/constant" "Open_IM/pkg/common/constant"
"Open_IM/pkg/common/db/rocks_cache" rocksCache "Open_IM/pkg/common/db/rocks_cache"
"Open_IM/pkg/common/log" "Open_IM/pkg/common/log"
"Open_IM/pkg/grpc-etcdv3/getcdv3" "Open_IM/pkg/grpc-etcdv3/getcdv3"
pbCache "Open_IM/pkg/proto/cache" pbCache "Open_IM/pkg/proto/cache"
"Open_IM/pkg/utils" "Open_IM/pkg/utils"
"context" "context"
"google.golang.org/grpc"
"net" "net"
"strconv" "strconv"
"strings" "strings"
"google.golang.org/grpc"
) )
type cacheServer struct { type cacheServer struct {
@ -67,6 +68,7 @@ func (s *cacheServer) Run() {
log.NewError("0", "RegisterEtcd failed ", err.Error()) log.NewError("0", "RegisterEtcd failed ", err.Error())
return return
} }
go rocksCache.DelKeys()
err = srv.Serve(listener) err = srv.Serve(listener)
if err != nil { if err != nil {
log.NewError("0", "Serve failed ", err.Error()) log.NewError("0", "Serve failed ", err.Error())

View File

@ -36,7 +36,7 @@ const (
conversationIDListCache = "CONVERSATION_ID_LIST_CACHE:" conversationIDListCache = "CONVERSATION_ID_LIST_CACHE:"
) )
func init() { func DelKeys() {
fmt.Println("init to del old keys") fmt.Println("init to del old keys")
for _, key := range []string{groupCache, friendRelationCache, blackListCache, userInfoCache, groupInfoCache, groupOwnerIDCache, joinedGroupListCache, for _, key := range []string{groupCache, friendRelationCache, blackListCache, userInfoCache, groupInfoCache, groupOwnerIDCache, joinedGroupListCache,
groupMemberInfoCache, groupAllMemberInfoCache, allFriendInfoCache} { groupMemberInfoCache, groupAllMemberInfoCache, allFriendInfoCache} {