net.sf.ehcache.config.Configuration.setClassLoader()方法的使用及代码示例

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

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

Configuration.setClassLoader介绍

[英]Set the classloader for the cache manager (and it's associated caches) to use when creating application objects (eg. cache values, event listeners, etc). The default classloading behavior is to prefer Thread.currentThread().getContextClassLoader() and fallback to the classloader that loaded ehcache itself.
[中]为缓存管理器(及其关联的缓存)设置创建应用程序对象(例如缓存值、事件侦听器等)时要使用的类加载器。默认的类加载行为是首选线程。currentThread()。getContextClassLoader()并回退到加载ehcache本身的类加载器。

代码示例

代码示例来源:origin: org.ehcache/jcache

configuration.setName(uri.toString() + "::" + classLoader.toString() + "::" + this.toString());
configuration.setClassLoader(classLoader);
final net.sf.ehcache.CacheManager ehcacheManager = new net.sf.ehcache.CacheManager(configuration);
cacheManager = new JCacheManager(this, ehcacheManager, uri, properties);

代码示例来源:origin: ehcache/ehcache-jcache

configuration.setName(uri.toString() + "::" + classLoader.toString() + "::" + this.toString());
configuration.setClassLoader(classLoader);
final net.sf.ehcache.CacheManager ehcacheManager = new net.sf.ehcache.CacheManager(configuration);
cacheManager = new JCacheManager(this, ehcacheManager, uri, properties);

代码示例来源:origin: org.osgl/osgl-cache

EhCacheService(String name) {
  if (S.notBlank(name)) {
    cacheName = name;
  }
  Configuration configuration = ConfigurationFactory.parseConfiguration();
  configuration.setClassLoader(CacheServiceProvider.Impl.classLoader());
  cacheManager = CacheManager.create(configuration);
  Cache cache = cacheManager.getCache(cacheName);
  if (null == cache) {
    cache = (Cache)cacheManager.addCacheIfAbsent(cacheName);
  }
  this.cache = cache;
  long l = this.cache.getCacheConfiguration().getTimeToLiveSeconds();
  if (0 != l) {
    defaultTTL = (int)l;
  }
}

相关文章

Configuration类方法