|
|
@ -210,6 +210,27 @@ public class UserBadgeRedis { |
|
|
|
return NumConstant.ONE; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 用户点亮或取消徽章 强一致性 |
|
|
|
* @param |
|
|
|
* @return long |
|
|
|
* @author wangc |
|
|
|
* @date 2020.11.25 14:17 |
|
|
|
*/ |
|
|
|
public long illumeOrExtinguishStronglyConsistent(String userId, String customerId){ |
|
|
|
List<UserBadgeUnitFormDTO> db = badgeService.getUserSortedBadge(userId,customerId); |
|
|
|
redisUtils.delete(UserRedisKeys.getResiUserBadgeKey(customerId,userId)); |
|
|
|
if(CollectionUtils.isNotEmpty(db)) { |
|
|
|
redisTemplate.executePipelined((RedisCallback<List<UserBadgeUnitFormDTO>>) connection -> { |
|
|
|
db.forEach(badge -> { |
|
|
|
connection.listCommands().rPush(UserRedisKeys.getResiUserBadgeKey(customerId, userId).getBytes(), |
|
|
|
redisTemplate.getValueSerializer().serialize(badge)); |
|
|
|
}); |
|
|
|
return null; |
|
|
|
}); |
|
|
|
} |
|
|
|
return NumConstant.ONE; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 批量清除用户徽章信息,用处:在客户取消点亮某个徽章后,批量清除该客户下所有用户的徽章缓存,当需要查取时再次初始化进缓存中 |
|
|
|