org.apache.ibatis.session.Configuration.getCache()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(3.3k)|赞(0)|评价(0)|浏览(93)

本文整理了Java中org.apache.ibatis.session.Configuration.getCache()方法的一些代码示例,展示了Configuration.getCache()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Configuration.getCache()方法的具体详情如下:
包路径:org.apache.ibatis.session.Configuration
类名称:Configuration
方法名:getCache

Configuration.getCache介绍

暂无

代码示例

代码示例来源:origin: camunda/camunda-bpm-platform

public Cache useCacheRef(String namespace) {
 if (namespace == null) {
  throw new BuilderException("cache-ref element requires a namespace attribute.");
 }
 try {
  unresolvedCacheRef = true;
  Cache cache = configuration.getCache(namespace);
  if (cache == null) {
   throw new IncompleteElementException("No cache for namespace '" + namespace + "' could be found.");
  }
  currentCache = cache;
  unresolvedCacheRef = false;
  return cache;
 } catch (IllegalArgumentException e) {
  throw new IncompleteElementException("No cache for namespace '" + namespace + "' could be found.", e);
 }
}

代码示例来源:origin: org.mybatis/mybatis

public Cache useCacheRef(String namespace) {
 if (namespace == null) {
  throw new BuilderException("cache-ref element requires a namespace attribute.");
 }
 try {
  unresolvedCacheRef = true;
  Cache cache = configuration.getCache(namespace);
  if (cache == null) {
   throw new IncompleteElementException("No cache for namespace '" + namespace + "' could be found.");
  }
  currentCache = cache;
  unresolvedCacheRef = false;
  return cache;
 } catch (IllegalArgumentException e) {
  throw new IncompleteElementException("No cache for namespace '" + namespace + "' could be found.", e);
 }
}

代码示例来源:origin: com.talanlabs/bean-mybatis

@Override
public Cache getCache(String id) {
  if (hasCache(id)) {
    return super.getCache(id);
  }
  return super.getCache(id);
}

代码示例来源:origin: com.talanlabs/component-mybatis

@Override
public Cache getCache(String id) {
  if (hasCache(id)) {
    return super.getCache(id);
  }
  return super.getCache(id);
}

代码示例来源:origin: org.apache.ibatis/ibatis-core

public Cache useCacheRef(String namespace) {
 if (namespace == null) {
  throw new BuilderException("cache-ref element requires a namespace attribute.");
 }
 Cache cache = configuration.getCache(namespace);
 if (cache == null) {
  throw new BuilderException("No cache for namespace '" + namespace + "' could be found.");
 }
 currentCache = cache;
 return cache;
}

代码示例来源:origin: com.talanlabs/bean-mybatis

@Override
public void clear() {
  if (beanCacheManager.isDispatch()) {
    beanCacheManager.undispatch();
    beanCacheManager.getCacheLinks(beanClass).forEach(cacheName -> configuration.getCache(cacheName).clear());
    beanCacheManager.dispatch();
    beanCacheManager.fireCleared(getId());
  }
}

代码示例来源:origin: com.hand.hap.cloud/hap-mybatis-mapper-starter

/**
 * 检查是否配置过缓存
 *
 * @param ms
 * @throws Exception
 */
private void checkCache(MappedStatement ms) throws Exception {
  if (ms.getCache() == null) {
    String nameSpace = ms.getId().substring(0, ms.getId().lastIndexOf("."));
    Cache cache;
    try {
      //不存在的时候会抛出异常
      cache = ms.getConfiguration().getCache(nameSpace);
    } catch (IllegalArgumentException e) {
      return;
    }
    if (cache != null) {
      MetaObject metaObject = SystemMetaObject.forObject(ms);
      metaObject.setValue("cache", cache);
    }
  }
}

代码示例来源:origin: com.talanlabs/component-mybatis

@Override
public void clear() {
  if (componentCacheManager.isDispatch()) {
    componentCacheManager.undispatch();
    componentCacheManager.getCacheLinks(componentClass).forEach(cacheName -> configuration.getCache(cacheName).clear());
    componentCacheManager.dispatch();
    componentCacheManager.fireCleared(getId());
  }
}

相关文章

微信公众号

最新文章

更多

Configuration类方法