1 导包
org.springframework.boot spring-boot-starter-cache
2 启动类添加注解@EnableCaching
3 使用:注入方式
3.1 注入
@Autowired
private CacheManager cacheManager;
3.2 获取缓存
Cache.ValueWrapper valueWrapper = cacheManager.getCache(key).get(key);
if (valueWrapper != null){
return valueWrapper.get();
}
3.3 存储缓存
cacheManager.getCache(key).put(key,value);
3.4 清理缓存
cacheManager.getCache(key).clear();



