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

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

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

Configuration.addDiskStore介绍

[英]Allows BeanHandler to add disk store location to the configuration.
[中]允许BeanHandler将磁盘存储位置添加到配置中。

代码示例

代码示例来源:origin: jooby-project/jooby

private void diskStore(final Config conf) {
 DiskStoreConfiguration diskStore = new DiskStoreConfiguration();
 diskStore.setPath(conf.getString("path"));
 eh.addDiskStore(diskStore);
}

代码示例来源:origin: net.sf.ehcache/ehcache

/**
 * Builder to add a disk store to the cache manager, only one disk store can be added.
 *
 * @param diskStoreConfigurationParameter
 *            the disk store configuration to use
 * @return this configuration instance
 * @throws ObjectExistsException
 *             if the disk store has already been configured
 */
public final Configuration diskStore(DiskStoreConfiguration diskStoreConfigurationParameter) throws ObjectExistsException {
  addDiskStore(diskStoreConfigurationParameter);
  return this;
}

代码示例来源:origin: org.sonatype.nexus.bundles/org.sonatype.nexus.bundles.ehcache

/**
 * Builder to add a disk store to the cache manager, only one disk store can be added.
 *
 * @param diskStoreConfigurationParameter
 *            the disk store configuration to use
 * @return this configuration instance
 * @throws ObjectExistsException
 *             if the disk store has already been configured
 */
public final Configuration diskStore(DiskStoreConfiguration diskStoreConfigurationParameter) throws ObjectExistsException {
  addDiskStore(diskStoreConfigurationParameter);
  return this;
}

代码示例来源:origin: net.sf.ehcache.internal/ehcache-core

/**
 * Builder to add a disk store to the cache manager, only one disk store can be added.
 *
 * @param diskStoreConfigurationParameter
 *            the disk store configuration to use
 * @return this configuration instance
 * @throws ObjectExistsException
 *             if the disk store has already been configured
 */
public final Configuration diskStore(DiskStoreConfiguration diskStoreConfigurationParameter) throws ObjectExistsException {
  addDiskStore(diskStoreConfigurationParameter);
  return this;
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.ehcache

/**
 * Builder to add a disk store to the cache manager, only one disk store can be added.
 *
 * @param diskStoreConfigurationParameter
 *            the disk store configuration to use
 * @return this configuration instance
 * @throws ObjectExistsException
 *             if the disk store has already been configured
 */
public final Configuration diskStore(DiskStoreConfiguration diskStoreConfigurationParameter) throws ObjectExistsException {
  addDiskStore(diskStoreConfigurationParameter);
  return this;
}

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

private void diskStore(final Config conf) {
 DiskStoreConfiguration diskStore = new DiskStoreConfiguration();
 diskStore.setPath(conf.getString("path"));
 eh.addDiskStore(diskStore);
}

代码示例来源:origin: rtyley/mini-git-server

private void configureDiskStore() {
 boolean needDisk = false;
 for (CacheProvider<?, ?> p : caches.values()) {
  if (p.disk()) {
   needDisk = true;
   break;
  }
 }
 if (!needDisk) {
  return;
 }
 File loc = site.resolve(config.getString("cache", null, "directory"));
 if (loc == null) {
 } else if (loc.exists() || loc.mkdirs()) {
  if (loc.canWrite()) {
   final DiskStoreConfiguration c = new DiskStoreConfiguration();
   c.setPath(loc.getAbsolutePath());
   mgr.addDiskStore(c);
   log.info("Enabling disk cache " + loc.getAbsolutePath());
  } else {
   log.warn("Can't write to disk cache: " + loc.getAbsolutePath());
  }
 } else {
  log.warn("Can't create disk cache: " + loc.getAbsolutePath());
 }
}

代码示例来源:origin: com.madgag/mini-git-server-server

private void configureDiskStore() {
 boolean needDisk = false;
 for (CacheProvider<?, ?> p : caches.values()) {
  if (p.disk()) {
   needDisk = true;
   break;
  }
 }
 if (!needDisk) {
  return;
 }
 File loc = site.resolve(config.getString("cache", null, "directory"));
 if (loc == null) {
 } else if (loc.exists() || loc.mkdirs()) {
  if (loc.canWrite()) {
   final DiskStoreConfiguration c = new DiskStoreConfiguration();
   c.setPath(loc.getAbsolutePath());
   mgr.addDiskStore(c);
   log.info("Enabling disk cache " + loc.getAbsolutePath());
  } else {
   log.warn("Can't write to disk cache: " + loc.getAbsolutePath());
  }
 } else {
  log.warn("Can't create disk cache: " + loc.getAbsolutePath());
 }
}

代码示例来源:origin: org.kantega.openaksess/openaksess-core

@Override
public void afterPropertiesSet() throws IOException, CacheException {
  InputStream is = XmlMerger.merge(OA_XML_CONFIG_FILE, PROJECT_XML_CONFIG_FILE, servletContext);
  Configuration configuration = ConfigurationFactory.parseConfiguration(is);
  String path = System.getProperty("java.io.tmpdir") + servletContext.getContextPath() + "/ehcache";
  configuration.addDiskStore(new DiskStoreConfiguration().path(path));
  configuration.setName(configuration.getName() + servletContext.getContextPath() + UUID.randomUUID());
  cacheManager = new CacheManager(configuration);
  createMBean();
}

代码示例来源:origin: org.onebusaway/onebusaway-container

public void afterPropertiesSet() throws IOException, CacheException {
 logger.info("Initializing EHCache CacheManager");
 this.configuration = ConfigurationFactory.parseConfiguration(this.configLocation.getInputStream());
 if (this.diskStorePath != null) {
  logger.info("diskStorePath=" + this.diskStorePath);
  DiskStoreConfiguration dsConfig = new DiskStoreConfiguration();
  dsConfig.setPath(this.diskStorePath);
  logger.info("diskStorePath (translated)=" + dsConfig.getPath());
  configuration.addDiskStore(dsConfig);
 }
 if (this.terracottaUrl != null) {
  logger.info("terracottaUrl=" + this.terracottaUrl);
  TerracottaConfigConfiguration tcConfig = new TerracottaConfigConfiguration();
  tcConfig.setUrl(this.terracottaUrl);
  configuration.addTerracottaConfig(tcConfig);
 }
}

代码示例来源:origin: OneBusAway/onebusaway-application-modules

public void afterPropertiesSet() throws IOException, CacheException {
 logger.info("Initializing EHCache CacheManager");
 this.configuration = ConfigurationFactory.parseConfiguration(this.configLocation.getInputStream());
 if (this.diskStorePath != null) {
  logger.info("diskStorePath=" + this.diskStorePath);
  DiskStoreConfiguration dsConfig = new DiskStoreConfiguration();
  dsConfig.setPath(this.diskStorePath);
  logger.info("diskStorePath (translated)=" + dsConfig.getPath());
  configuration.addDiskStore(dsConfig);
 }
 if (this.terracottaUrl != null) {
  logger.info("terracottaUrl=" + this.terracottaUrl);
  TerracottaClientConfiguration tcConfig = new TerracottaClientConfiguration();
  tcConfig.setUrl(this.terracottaUrl);
  configuration.addTerracottaConfig(tcConfig);
 }
}

代码示例来源:origin: ujmp/universal-java-matrix-package

private CacheManager getCacheManager() {
  if (manager == null) {
    Configuration config = new Configuration();
    CacheConfiguration cacheconfig = new CacheConfiguration(getName(), maxElementsInMemory);
    cacheconfig.setDiskExpiryThreadIntervalSeconds(diskExpiryThreadIntervalSeconds);
    cacheconfig.setDiskPersistent(diskPersistent);
    cacheconfig.setEternal(eternal);
    cacheconfig.setMaxElementsOnDisk(maxElementsOnDisk);
    cacheconfig.setMemoryStoreEvictionPolicyFromObject(memoryStoreEvictionPolicy);
    cacheconfig.setOverflowToDisk(overflowToDisk);
    cacheconfig.setTimeToIdleSeconds(timeToIdleSeconds);
    cacheconfig.setTimeToLiveSeconds(timeToLiveSeconds);
    DiskStoreConfiguration diskStoreConfigurationParameter = new DiskStoreConfiguration();
    diskStoreConfigurationParameter.setPath(getPath().getAbsolutePath());
    config.addDiskStore(diskStoreConfigurationParameter);
    config.setDefaultCacheConfiguration(cacheconfig);
    manager = new CacheManager(config);
  }
  return manager;
}

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

private CacheManager getCacheManager() {
  if (manager == null) {
    Configuration config = new Configuration();
    CacheConfiguration cacheconfig = new CacheConfiguration(getName(), maxElementsInMemory);
    cacheconfig.setDiskExpiryThreadIntervalSeconds(diskExpiryThreadIntervalSeconds);
    cacheconfig.setDiskPersistent(diskPersistent);
    cacheconfig.setEternal(eternal);
    cacheconfig.setMaxElementsOnDisk(maxElementsOnDisk);
    cacheconfig.setMemoryStoreEvictionPolicyFromObject(memoryStoreEvictionPolicy);
    cacheconfig.setOverflowToDisk(overflowToDisk);
    cacheconfig.setTimeToIdleSeconds(timeToIdleSeconds);
    cacheconfig.setTimeToLiveSeconds(timeToLiveSeconds);
    DiskStoreConfiguration diskStoreConfigurationParameter = new DiskStoreConfiguration();
    diskStoreConfigurationParameter.setPath(getPath().getAbsolutePath());
    config.addDiskStore(diskStoreConfigurationParameter);
    config.setDefaultCacheConfiguration(cacheconfig);
    manager = new CacheManager(config);
  }
  return manager;
}

相关文章

Configuration类方法