MybatisMetricsEhcacheFactory.java 文件源码

java
阅读 29 收藏 0 点赞 0 评论 0

项目:mybatis-ehcache-spring 作者:
@Override
public Cache getCache(String id) {
  if (id == null) {
    throw new IllegalArgumentException("Cache instances require an ID");
  }

  if (!cacheManager.cacheExists(id)) {
    CacheConfiguration temp = null;
    if (cacheConfiguration != null) {
      temp = cacheConfiguration.clone();
    } else {
      // based on defaultCache
      temp = cacheManager.getConfiguration().getDefaultCacheConfiguration().clone();
    }
    temp.setName(id);
    net.sf.ehcache.Cache cache = new net.sf.ehcache.Cache(temp);
    Ehcache instrumentCache = InstrumentedEhcache.instrument(registry, cache);
    cacheManager.addCache(instrumentCache);
  }
  return new EhcacheCache(id, cacheManager.getEhcache(id));
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号