| | |
| | | |
| | | private static final Long MILLIS_MINUTE_TEN = 20 * 60 * 1000L; |
| | | |
| | | private static final Long MILLIS_DAY = 60 * MILLIS_SECOND * 60 * 24; |
| | | private static final long MILLIS_DAY = 60 * MILLIS_SECOND * 60 * 24; |
| | | |
| | | @Autowired |
| | | private RedisCache redisCache; |
| | |
| | | loginUser.setExpireTime(loginUser.getLoginTime() + MILLIS_DAY); |
| | | // 根据uuid将loginUser缓存 |
| | | String userKey = getTokenKey(loginUser.getToken()); |
| | | redisCache.setCacheObject(userKey, loginUser, Math.toIntExact(MILLIS_DAY), TimeUnit.MINUTES); |
| | | redisCache.setCacheObject(userKey, loginUser,1, TimeUnit.DAYS); |
| | | if (!soloLogin) { |
| | | // 缓存用户唯一标识,防止同一帐号,同时登录 |
| | | String userIdKey = getUserIdKey(loginUser.getUser().getUserId()); |
| | | redisCache.setCacheObject(userIdKey, userKey, Math.toIntExact(MILLIS_DAY), TimeUnit.MINUTES); |
| | | redisCache.setCacheObject(userIdKey, userKey, 1, TimeUnit.DAYS); |
| | | } |
| | | } |
| | | |