mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-12 21:16:00 +08:00
cache
This commit is contained in:
Vendored
+2
@@ -187,6 +187,7 @@ func (s *cacheServer) GetFriendIDListFromCache(_ context.Context, req *pbCache.G
|
|||||||
resp.CommonResp.ErrMsg = constant.ErrDB.ErrMsg
|
resp.CommonResp.ErrMsg = constant.ErrDB.ErrMsg
|
||||||
return resp, nil
|
return resp, nil
|
||||||
}
|
}
|
||||||
|
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), friendIDList)
|
||||||
resp.UserIDList = friendIDList
|
resp.UserIDList = friendIDList
|
||||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp.String())
|
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp.String())
|
||||||
return resp, nil
|
return resp, nil
|
||||||
@@ -228,6 +229,7 @@ func (s *cacheServer) GetBlackIDListFromCache(_ context.Context, req *pbCache.Ge
|
|||||||
resp.CommonResp.ErrMsg = constant.ErrDB.ErrMsg
|
resp.CommonResp.ErrMsg = constant.ErrDB.ErrMsg
|
||||||
return resp, nil
|
return resp, nil
|
||||||
}
|
}
|
||||||
|
log.NewDebug(req.OperationID, utils.GetSelfFuncName(), blackUserIDList)
|
||||||
resp.UserIDList = blackUserIDList
|
resp.UserIDList = blackUserIDList
|
||||||
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp.String())
|
log.NewInfo(req.OperationID, utils.GetSelfFuncName(), "resp: ", resp.String())
|
||||||
return resp, nil
|
return resp, nil
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import (
|
|||||||
pbCommon "Open_IM/pkg/proto/sdk_ws"
|
pbCommon "Open_IM/pkg/proto/sdk_ws"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"github.com/garyburd/redigo/redis"
|
"github.com/garyburd/redigo/redis"
|
||||||
"strings"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -193,8 +192,8 @@ func (d *DataBases) ReduceFriendToCache(userID string, friendIDList ...interface
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (d *DataBases) GetFriendIDListFromCache(userID string) ([]string, error) {
|
func (d *DataBases) GetFriendIDListFromCache(userID string) ([]string, error) {
|
||||||
result, err := redis.String(d.Exec("SMEMBERS", friendRelationCache+userID))
|
result, err := redis.Strings(d.Exec("SMEMBERS", friendRelationCache+userID))
|
||||||
return strings.Split(result, " "), err
|
return result, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *DataBases) AddBlackUserToCache(userID string, blackList ...interface{}) error {
|
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) {
|
func (d *DataBases) GetBlackListFromCache(userID string) ([]string, error) {
|
||||||
result, err := redis.String(d.Exec("SMEMBERS", blackListCache+userID))
|
result, err := redis.Strings(d.Exec("SMEMBERS", blackListCache+userID))
|
||||||
return strings.Split(result, " "), err
|
return result, err
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user