- 注入一个cacheManager
@Autowired
public CacheManager cacheManager;
2.获取cache 将他转为net.sf.ehcache.Cache,这边就有getKeys就可以获取到了
net.sf.ehcache.Cache spApiConfig = (net.sf.ehcache.Cache) cacheManager.getCache(cacheName).getNativeCache();
@Autowired
public CacheManager cacheManager;
2.获取cache 将他转为net.sf.ehcache.Cache,这边就有getKeys就可以获取到了
net.sf.ehcache.Cache spApiConfig = (net.sf.ehcache.Cache) cacheManager.getCache(cacheName).getNativeCache();
本文标题:springcache使用ehcache实现缓存获取所有keys
本文链接:https://www.haomeiwen.com/subject/qrqizltx.html
网友评论