内存缓存的方式
//1.利用static 初始化时执行static代码块,put进去,做缓存。
public class Cache {
//利用static 就不需要spring @Compoent 单例模式 因为static 保证了全局唯一,不会new 出来新的,同时final 将指针固定,保证 mapCache 一定是 hashMap.
private static final Map<String, User> mapCache = new
内存缓存的方式
//1.利用static 初始化时执行static代码块,put进去,做缓存。
public class Cache {
//利用static 就不需要spring @Compoent 单例模式 因为static 保证了全局唯一,不会new 出来新的,同时final 将指针固定,保证 mapCache 一定是 hashMap.
private static final Map<String, User> mapCache = new