/** 获取在线用户数量 */ public static Long getAllUserNumber() { String v = JedisUtil.get(Constants.ALLUSER_NUMBER); if (v != null) { return Long.valueOf(v); } return 0L; }
private void setAllUserNumber(int n) { Long number = getAllUserNumber() + n; if (number >= 0) { logger.info("用户数:" + number); JedisUtil.set(Constants.ALLUSER_NUMBER, 60 * 60 * 24, number); } }