mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-07 02:26:00 +08:00
fix: not support redis cluster. CROSSSLOT Keys in request don't hash to the same slot (#1258)
* feat: v2 to v3 data conversion * feat: v2 to v3 data conversion * fix: CallbackBeforeCreateGroup * fix: NotificationUserInfoUpdate * fix: NotificationUserInfoUpdate * chore: update pkg github.com/OpenIMSDK/protocol v0.0.26 * chore: code format * update pkg * feat: QuitGroup support administrator operations * feat: QuitGroup support administrator operations * fix: checkMongo uri * fix: k8s minio prefix * fix: k8s minio prefix * fix: k8s minio prefix * fix: k8s minio prefix test * fix: k8s minio prefix test * fix: GetUsersInfo cache * fix: redis cache * fix: redis remove pipeline * fix: redis remove pipeline
This commit is contained in:
Vendored
+26
-23
@@ -112,29 +112,32 @@ func (u *UserCacheRedis) GetUserInfo(ctx context.Context, userID string) (userIn
|
||||
}
|
||||
|
||||
func (u *UserCacheRedis) GetUsersInfo(ctx context.Context, userIDs []string) ([]*relationtb.UserModel, error) {
|
||||
keys := make([]string, 0, len(userIDs))
|
||||
for _, userID := range userIDs {
|
||||
keys = append(keys, u.getUserInfoKey(userID))
|
||||
}
|
||||
|
||||
return batchGetCache(
|
||||
ctx,
|
||||
u.rcClient,
|
||||
keys,
|
||||
u.expireTime,
|
||||
func(user *relationtb.UserModel, keys []string) (int, error) {
|
||||
for i, key := range keys {
|
||||
if key == u.getUserInfoKey(user.UserID) {
|
||||
return i, nil
|
||||
}
|
||||
}
|
||||
|
||||
return 0, errIndex
|
||||
},
|
||||
func(ctx context.Context) ([]*relationtb.UserModel, error) {
|
||||
return u.userDB.Find(ctx, userIDs)
|
||||
},
|
||||
)
|
||||
//var keys []string
|
||||
//for _, userID := range userIDs {
|
||||
// keys = append(keys, u.getUserInfoKey(userID))
|
||||
//}
|
||||
//return batchGetCache(
|
||||
// ctx,
|
||||
// u.rcClient,
|
||||
// keys,
|
||||
// u.expireTime,
|
||||
// func(user *relationtb.UserModel, keys []string) (int, error) {
|
||||
// for i, key := range keys {
|
||||
// if key == u.getUserInfoKey(user.UserID) {
|
||||
// return i, nil
|
||||
// }
|
||||
// }
|
||||
// return 0, errIndex
|
||||
// },
|
||||
// func(ctx context.Context) ([]*relationtb.UserModel, error) {
|
||||
// return u.userDB.Find(ctx, userIDs)
|
||||
// },
|
||||
//)
|
||||
return batchGetCache2(ctx, u.rcClient, u.expireTime, userIDs, func(userID string) string {
|
||||
return u.getUserInfoKey(userID)
|
||||
}, func(ctx context.Context, userID string) (*relationtb.UserModel, error) {
|
||||
return u.userDB.Take(ctx, userID)
|
||||
})
|
||||
}
|
||||
|
||||
func (u *UserCacheRedis) DelUsersInfo(userIDs ...string) UserCache {
|
||||
|
||||
Reference in New Issue
Block a user