mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-06 04:15:46 +08:00
cache
This commit is contained in:
parent
b72787f5bb
commit
93057870a7
2
internal/rpc/cache/cache.go
vendored
2
internal/rpc/cache/cache.go
vendored
@ -187,6 +187,7 @@ func (s *cacheServer) GetFriendIDListFromCache(_ context.Context, req *pbCache.G
|
||||
resp.CommonResp.ErrMsg = constant.ErrDB.ErrMsg
|
||||
return resp, nil
|
||||
}
|
||||
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), friendIDList)
|
||||
resp.UserIDList = friendIDList
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp.String())
|
||||
return resp, nil
|
||||
@ -228,6 +229,7 @@ func (s *cacheServer) GetBlackIDListFromCache(_ context.Context, req *pbCache.Ge
|
||||
resp.CommonResp.ErrMsg = constant.ErrDB.ErrMsg
|
||||
return resp, nil
|
||||
}
|
||||
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), blackUserIDList)
|
||||
resp.UserIDList = blackUserIDList
|
||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp.String())
|
||||
return resp, nil
|
||||
|
@ -6,7 +6,6 @@ import (
|
||||
pbCommon "Open_IM/pkg/proto/sdk_ws"
|
||||
"encoding/json"
|
||||
"github.com/garyburd/redigo/redis"
|
||||
"strings"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -193,8 +192,8 @@ func (d *DataBases) ReduceFriendToCache(userID string, friendIDList ...interface
|
||||
}
|
||||
|
||||
func (d *DataBases) GetFriendIDListFromCache(userID string) ([]string, error) {
|
||||
result, err := redis.String(d.Exec("SMEMBERS", friendRelationCache+userID))
|
||||
return strings.Split(result, " "), err
|
||||
result, err := redis.Strings(d.Exec("SMEMBERS", friendRelationCache+userID))
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (d *DataBases) AddBlackUserToCache(userID string, blackList ...interface{}) error {
|
||||
@ -208,6 +207,6 @@ func (d *DataBases) ReduceBlackUserFromCache(userID string, blackList ...interfa
|
||||
}
|
||||
|
||||
func (d *DataBases) GetBlackListFromCache(userID string) ([]string, error) {
|
||||
result, err := redis.String(d.Exec("SMEMBERS", blackListCache+userID))
|
||||
return strings.Split(result, " "), err
|
||||
result, err := redis.Strings(d.Exec("SMEMBERS", blackListCache+userID))
|
||||
return result, err
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user