package pwc.taxtech.atms; import pwc.taxtech.atms.dto.user.UserDto; import pwc.taxtech.atms.service.OperationLogService; import java.util.HashMap; import java.util.Map; public class AppCachePool { private static Map<String, UserDto> CACHED_USERS = null; private static Object _locker = new Object(); static { CACHED_USERS = new HashMap<>(); } public static UserDto getCachedUser(String name) { String userName = name.toLowerCase(); synchronized (_locker) { if (!CACHED_USERS.containsKey(userName)) { UserDto dto = new UserDto();//TODO:should fixed to load from db (neo) dto.setUserName("cach_test"); dto.setID("1"); CACHED_USERS.put(userName,dto); } return CACHED_USERS.get(userName); } } }