From 7d389693b9b19dcf60e2fb309b436943e63eb775 Mon Sep 17 00:00:00 2001 From: zhangshanxue Date: Tue, 5 Nov 2019 13:44:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E5=99=A8=E6=8E=A8=E8=8D=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ljsd/controller/GetServerListController.java | 5 +++-- src/main/java/com/ljsd/redis/RedisApp.java | 1 - 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/ljsd/controller/GetServerListController.java b/src/main/java/com/ljsd/controller/GetServerListController.java index ec14be6..7e1cf90 100644 --- a/src/main/java/com/ljsd/controller/GetServerListController.java +++ b/src/main/java/com/ljsd/controller/GetServerListController.java @@ -55,7 +55,7 @@ public class GetServerListController extends HttpServlet { List serverList = new ArrayList<>(); long local = System.currentTimeMillis(); - if ((local - lastRefreshTime) > 60 * 1000 || serverInfosCache.isEmpty()) { + if ((local - lastRefreshTime) > 10 * 1000 || serverInfosCache.isEmpty()) { serverInfosCache.clear(); lastRefreshTime = local; recommend = ""; @@ -133,7 +133,7 @@ public class GetServerListController extends HttpServlet { Map userServerInfoMap = BaseGlobal.getInstance().redisApp.hgetAll(RedisKey.USER_SERVER_INFO, openId, UserRecentLoginInfo.class, -1, false); DBObject myLastServer = null; List myServerList = new ArrayList<>(); - int time = 0; + long time = 0; for (Map.Entry entry : userServerInfoMap.entrySet()) { if(!serverInfosCache.keySet().contains(entry.getKey())){ //服务器已清除 @@ -141,6 +141,7 @@ public class GetServerListController extends HttpServlet { } myServerList.add(entry.getKey()); if (entry.getValue().getLoginTime() > time) { + time =entry.getValue().getLoginTime(); myLastServer = getDBObject(entry.getKey(), entry.getValue()); } } diff --git a/src/main/java/com/ljsd/redis/RedisApp.java b/src/main/java/com/ljsd/redis/RedisApp.java index f4151dc..0e139af 100644 --- a/src/main/java/com/ljsd/redis/RedisApp.java +++ b/src/main/java/com/ljsd/redis/RedisApp.java @@ -42,7 +42,6 @@ public class RedisApp { public T get(final String type, final K key, final Class clazz, final int seconds, boolean withServerId) throws Exception { String fullKey = getKey(type, key, withServerId); - System.out.println("-------fullKey---------"+fullKey); String strValue = redisUtil.get(fullKey); if (strValue == null) { return null;