package cn.com.tenlion.accesstokenmanager; import cn.com.tenlion.pojo.dtos.carduser.CardUserDTO; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; /** * TODO * @version 1.0 * @author LY * @date 2021/1/27 11:00 */ public class AccessTokenManager { private static Map cardUserVOMap = new ConcurrentHashMap<>(); private AccessTokenManager(){ } public static AccessTokenManager getInstance(){ return tokenManageBuiler.accessTokenInstance; } public CardUserDTO getKey(String key){ return cardUserVOMap.get(key); } public void setKey(String key,CardUserDTO cardUserDTO){ cardUserVOMap.put(key,cardUserDTO); } public void removeKey(String key){ cardUserVOMap.remove(key); } public Map getKeyList(){ return cardUserVOMap; } public void updateLastActivityTime(String key){ CardUserDTO dto = this.getKey(key); dto.setLastActivityTime(System.currentTimeMillis()); } private static class tokenManageBuiler{ private static AccessTokenManager accessTokenInstance = new AccessTokenManager(); } }