@Override public void updateOnlineState(long uid) { try { memcachedClient.set(MemcachedKeyGenerator.genUserOnlineKey(uid), userOnlineExpireTime, true); } catch (Exception e) { log.error(e.getMessage(), e); } }
@Override public void logout(HttpServletRequest request, HttpServletResponse response, long uid) { loginSessionManager.logout(request, response); try { memcachedClient.delete(MemcachedKeyGenerator.genUserOnlineKey(uid)); } catch (Exception e) { log.error(e.getMessage(), e); } }
@Override public boolean isOnline(long uid) { try { Boolean online = memcachedClient.get(MemcachedKeyGenerator.genUserOnlineKey(uid)); return online == null ? false : online; } catch (Exception e) { log.error(e.getMessage(), e); return false; } }