mirror of
https://github.com/zongzibinbin/MallChat.git
synced 2026-03-15 07:03:42 +08:00
缓存改成全使用string模式
This commit is contained in:
@@ -92,7 +92,7 @@ public class UserCache {
|
||||
public Map<Long, User> getUserInfoBatch(Set<Long> uids) {
|
||||
List<String> keys = uids.stream().map(a -> RedisKey.getKey(RedisKey.USER_INFO_STRING, a)).collect(Collectors.toList());
|
||||
List<User> mget = redisUtils.mget(keys, User.class);
|
||||
Map<Long, User> map = mget.stream().collect(Collectors.toMap(User::getId, Function.identity()));
|
||||
Map<Long, User> map = mget.stream().filter(Objects::nonNull).collect(Collectors.toMap(User::getId, Function.identity()));
|
||||
//还需要load更新的uid
|
||||
List<Long> needLoadUidList = uids.stream().filter(a -> !map.containsKey(a)).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(needLoadUidList)) {
|
||||
|
||||
@@ -34,7 +34,7 @@ public class UserBackpackServiceImpl implements IUserBackpackService {
|
||||
|
||||
@Override
|
||||
@RedissonLock(key = "#uid")
|
||||
public void acquireItem(Long uid, Long itemId, IdempotentEnum idempotentEnum, String businessId) {//todo 分布式锁
|
||||
public void acquireItem(Long uid, Long itemId, IdempotentEnum idempotentEnum, String businessId) {
|
||||
String idempotent = getIdempotent(itemId, idempotentEnum, businessId);
|
||||
UserBackpack userBackpack = userBackpackDao.getByIdp(idempotent);
|
||||
//幂等检查
|
||||
|
||||
Reference in New Issue
Block a user