mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-04 09:05:59 +08:00
local cache
This commit is contained in:
@@ -11,5 +11,5 @@ func GetBlackIDsKey(ownerUserID string) string {
|
||||
}
|
||||
|
||||
func GetIsBlackIDsKey(possibleBlackUserID, userID string) string {
|
||||
return isBlackKey + possibleBlackUserID + "-" + userID
|
||||
return isBlackKey + userID + "-" + possibleBlackUserID
|
||||
}
|
||||
|
||||
@@ -50,9 +50,10 @@ func (f *FriendLocalCache) IsFriend(ctx context.Context, possibleFriendUserID, u
|
||||
return localcache.AnyValue[bool](f.local.Get(ctx, cachekey.GetIsFriendKey(possibleFriendUserID, userID), func(ctx context.Context) (any, error) {
|
||||
log.ZDebug(ctx, "FriendLocalCache IsFriend rpc", "possibleFriendUserID", possibleFriendUserID, "userID", userID)
|
||||
return f.client.IsFriend(ctx, possibleFriendUserID, userID)
|
||||
}, option.NewOption().WithLink(cachekey.GetFriendIDsKey(possibleFriendUserID), cachekey.GetFriendIDsKey(userID))))
|
||||
}, option.NewOption().WithLink(cachekey.GetFriendIDsKey(possibleFriendUserID))))
|
||||
}
|
||||
|
||||
// IsBlack possibleBlackUserID selfUserID
|
||||
func (f *FriendLocalCache) IsBlack(ctx context.Context, possibleBlackUserID, userID string) (val bool, err error) {
|
||||
log.ZDebug(ctx, "FriendLocalCache IsBlack req", "possibleBlackUserID", possibleBlackUserID, "userID", userID)
|
||||
defer func() {
|
||||
@@ -65,5 +66,5 @@ func (f *FriendLocalCache) IsBlack(ctx context.Context, possibleBlackUserID, use
|
||||
return localcache.AnyValue[bool](f.local.Get(ctx, cachekey.GetIsBlackIDsKey(possibleBlackUserID, userID), func(ctx context.Context) (any, error) {
|
||||
log.ZDebug(ctx, "FriendLocalCache IsBlack rpc", "possibleBlackUserID", possibleBlackUserID, "userID", userID)
|
||||
return f.client.IsBlack(ctx, possibleBlackUserID, userID)
|
||||
}, option.NewOption().WithLink(cachekey.GetBlackIDsKey(possibleBlackUserID), cachekey.GetBlackIDsKey(userID))))
|
||||
}, option.NewOption().WithLink(cachekey.GetBlackIDsKey(userID))))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user