当前位置: 首页>>代码示例>>Java>>正文


Java CacheBuilder类代码示例

本文整理汇总了Java中org.apache.ibatis.mapping.CacheBuilder的典型用法代码示例。如果您正苦于以下问题:Java CacheBuilder类的具体用法?Java CacheBuilder怎么用?Java CacheBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CacheBuilder类属于org.apache.ibatis.mapping包,在下文中一共展示了CacheBuilder类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: useNewCache

import org.apache.ibatis.mapping.CacheBuilder; //导入依赖的package包/类
public Cache useNewCache(Class<? extends Cache> typeClass,
    Class<? extends Cache> evictionClass,
    Long flushInterval,
    Integer size,
    boolean readWrite,
    boolean blocking,
    Properties props) {
  Cache cache = new CacheBuilder(currentNamespace)
      .implementation(valueOrDefault(typeClass, PerpetualCache.class))
      .addDecorator(valueOrDefault(evictionClass, LruCache.class))
      .clearInterval(flushInterval)
      .size(size)
      .readWrite(readWrite)
      .blocking(blocking)
      .properties(props)
      .build();
  configuration.addCache(cache);
  currentCache = cache;
  return cache;
}
 
开发者ID:yuexiahandao,项目名称:MybatisCode,代码行数:21,代码来源:MapperBuilderAssistant.java

示例2: useNewCache

import org.apache.ibatis.mapping.CacheBuilder; //导入依赖的package包/类
public Cache useNewCache(Class<? extends Cache> typeClass,
    Class<? extends Cache> evictionClass,
    Long flushInterval,
    Integer size,
    boolean readWrite,
    boolean blocking,
    Properties props) {
    //这里面又判断了一下是否为null就用默认值,有点和XMLMapperBuilder.cacheElement逻辑重复了
  typeClass = valueOrDefault(typeClass, PerpetualCache.class);
  evictionClass = valueOrDefault(evictionClass, LruCache.class);
  //调用CacheBuilder构建cache,id=currentNamespace
  Cache cache = new CacheBuilder(currentNamespace)
      .implementation(typeClass)
      .addDecorator(evictionClass)
      .clearInterval(flushInterval)
      .size(size)
      .readWrite(readWrite)
      .blocking(blocking)
      .properties(props)
      .build();
  //加入缓存
  configuration.addCache(cache);
  //当前的缓存
  currentCache = cache;
  return cache;
}
 
开发者ID:shurun19851206,项目名称:mybaties,代码行数:27,代码来源:MapperBuilderAssistant.java

示例3: useNewCache

import org.apache.ibatis.mapping.CacheBuilder; //导入依赖的package包/类
public Cache useNewCache(Class<? extends Cache> typeClass,
    Class<? extends Cache> evictionClass,
    Long flushInterval,
    Integer size,
    boolean readWrite,
    boolean blocking,
    Properties props) {
  typeClass = valueOrDefault(typeClass, PerpetualCache.class);
  evictionClass = valueOrDefault(evictionClass, LruCache.class);
  Cache cache = new CacheBuilder(currentNamespace)
      .implementation(typeClass)
      .addDecorator(evictionClass)
      .clearInterval(flushInterval)
      .size(size)
      .readWrite(readWrite)
      .blocking(blocking)
      .properties(props)
      .build();
  configuration.addCache(cache);
  currentCache = cache;
  return cache;
}
 
开发者ID:toulezu,项目名称:play,代码行数:23,代码来源:MapperBuilderAssistant.java


注:本文中的org.apache.ibatis.mapping.CacheBuilder类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。