@Test public void checkUserLoginStatus() throws Exception { boolean status = userInfoCacheService.saveAndCheckUserLoginStatus(2000L); LOGGER.info("status={}", status); }
@Override public boolean saveAndCheckUserLoginStatus(Long userId) throws Exception { Long add = redisTemplate.opsForSet().add(LOGIN_STATUS_PREFIX, userId.toString()); if (add == 0){ return false ; }else { return true ; } }
UserInfoCacheServiceImpl implements UserInfoCacheService { @Override public boolean saveAndCheckUserLoginStatus(Long userId) throws Exception { Long add = redisTemplate.opsForSet().add(LOGIN_STATUS_PREFIX, userId.toString()); if (add == 0){ return false ; }else { return true ; } } }
UserInfoCacheServiceImpl implements UserInfoCacheService { @Override public boolean saveAndCheckUserLoginStatus(Long userId) throws Exception { Long add = redisTemplate.opsForSet().add(LOGIN_STATUS_PREFIX, userId.toString()); if (add == 0){ return false ; }else { return true ; } }  }
UserInfoCacheServiceImpl implements UserInfoCacheService { @Override public boolean saveAndCheckUserLoginStatus(Long userId) throws Exception { Long add = redisTemplate.opsForSet().add(LOGIN_STATUS_PREFIX, userId.toString()); if (add == 0){ return false ; }else { return true ; } }  @Override CIMUserInfo loadUserInfoByUserId(Long userId); @Override boolean saveAndCheckUserLoginStatus(Long userId); @Override void removeLoginStatus(Long userId); @Override Set<CIMUserInfo> onlineUser(); }
UserInfoCacheServiceImpl implements UserInfoCacheService { @Override public boolean saveAndCheckUserLoginStatus(Long userId) throws Exception { Long add = redisTemplate.opsForSet().add(LOGIN_STATUS_PREFIX, userId.toString()); if (add == 0){ return false ; }else { return true ; } }  @Override CIMUserInfo loadUserInfoByUserId(Long userId); @Override boolean saveAndCheckUserLoginStatus(Long userId); @Override void removeLoginStatus(Long userId); @Override Set<CIMUserInfo> onlineUser();  }