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

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

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

Configuration.setDefaultCacheConfiguration介绍

暂无

代码示例

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

ehconfig.setDefaultCacheConfiguration(new CacheConfigurationBuilder("default").build(defcache));

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

/**
 * Builder method to set the default cache configuration, this can only be used once.
 *
 * @return this configuration instance
 * @throws ObjectExistsException
 *             if the default cache config has already been configured
 */
public final Configuration defaultCache(CacheConfiguration defaultCacheConfiguration) throws ObjectExistsException {
  setDefaultCacheConfiguration(defaultCacheConfiguration);
  return this;
}

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

/**
 * Allows BeanHandler to add a default configuration to the configuration.
 */
public final void addDefaultCache(CacheConfiguration defaultCacheConfiguration) throws ObjectExistsException {
  if (this.defaultCacheConfiguration != null) {
    throw new ObjectExistsException("The Default Cache has already been configured");
  }
  setDefaultCacheConfiguration(defaultCacheConfiguration);
}

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

/**
 * Builder method to set the default cache configuration, this can only be used once.
 *
 * @return this configuration instance
 * @throws ObjectExistsException
 *             if the default cache config has already been configured
 */
public final Configuration defaultCache(CacheConfiguration defaultCacheConfiguration) throws ObjectExistsException {
  setDefaultCacheConfiguration(defaultCacheConfiguration);
  return this;
}

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

/**
 * Builder method to set the default cache configuration, this can only be used once.
 *
 * @return this configuration instance
 * @throws ObjectExistsException
 *             if the default cache config has already been configured
 */
public final Configuration defaultCache(CacheConfiguration defaultCacheConfiguration) throws ObjectExistsException {
  setDefaultCacheConfiguration(defaultCacheConfiguration);
  return this;
}

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

/**
 * Builder method to set the default cache configuration, this can only be used once.
 *
 * @return this configuration instance
 * @throws ObjectExistsException
 *             if the default cache config has already been configured
 */
public final Configuration defaultCache(CacheConfiguration defaultCacheConfiguration) throws ObjectExistsException {
  setDefaultCacheConfiguration(defaultCacheConfiguration);
  return this;
}

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

/**
 * Allows BeanHandler to add a default configuration to the configuration.
 */
public final void addDefaultCache(CacheConfiguration defaultCacheConfiguration) throws ObjectExistsException {
  if (this.defaultCacheConfiguration != null) {
    throw new ObjectExistsException("The Default Cache has already been configured");
  }
  setDefaultCacheConfiguration(defaultCacheConfiguration);
}

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

/**
 * Allows BeanHandler to add a default configuration to the configuration.
 */
public final void addDefaultCache(CacheConfiguration defaultCacheConfiguration) throws ObjectExistsException {
  if (this.defaultCacheConfiguration != null) {
    throw new ObjectExistsException("The Default Cache has already been configured");
  }
  setDefaultCacheConfiguration(defaultCacheConfiguration);
}

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

/**
 * Allows BeanHandler to add a default configuration to the configuration.
 */
public final void addDefaultCache(CacheConfiguration defaultCacheConfiguration) throws ObjectExistsException {
  if (this.defaultCacheConfiguration != null) {
    throw new ObjectExistsException("The Default Cache has already been configured");
  }
  setDefaultCacheConfiguration(defaultCacheConfiguration);
}

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

ehconfig.setDefaultCacheConfiguration(new CacheConfigurationBuilder("default").build(defcache));

代码示例来源:origin: bonitasoft/bonita-engine

protected void buildCacheManagerWithDefaultConfiguration() throws SCacheException {
  if (cacheManager != null) {
    String message = "Unable to build a new Cache Manager as the existing one is still alive: " + cacheManager + ". ";
    if (logger.isLoggable(this.getClass(), TechnicalLogSeverity.TRACE)) {
      message += ". Last creation was: \n" + cacheManagerLastCreation;
    }
    throw new SCacheException(message);
  }
  final Configuration configuration = new Configuration();
  configuration.setDefaultCacheConfiguration(defaultCacheConfiguration);
  configuration.diskStore(new DiskStoreConfiguration().path(diskStorePath));
  cacheManager = new CacheManager(configuration);
  if (logger.isLoggable(this.getClass(), TechnicalLogSeverity.TRACE)) {
    cacheManagerLastCreation = getCacheManagerCreationDetails();
  }
}

代码示例来源:origin: bonitasoft/bonita-engine

protected void buildCacheManagerWithDefaultConfiguration() throws SCacheException {
  if (cacheManager != null) {
    String message = "Unable to build a new Cache Manager as the existing one is still alive: " + cacheManager + ". ";
    if (logger.isLoggable(this.getClass(), TechnicalLogSeverity.TRACE)) {
      message += ". Last creation was: \n" + cacheManagerLastCreation;
    }
    throw new SCacheException(message);
  }
  final Configuration configuration = new Configuration();
  configuration.setDefaultCacheConfiguration(defaultCacheConfiguration);
  configuration.diskStore(new DiskStoreConfiguration().path(diskStorePath));
  cacheManager = new CacheManager(configuration);
  if (logger.isLoggable(this.getClass(), TechnicalLogSeverity.TRACE)) {
    cacheManagerLastCreation = getCacheManagerCreationDetails();
  }
}

代码示例来源:origin: info.magnolia/magnolia-module-cache

@Override
public void start() {
  final Configuration cfg = ConfigurationFactory.parseConfiguration();
  cfg.setSource("ehcache defaults");
  if (defaultCacheConfiguration != null) {
    cfg.setDefaultCacheConfiguration(defaultCacheConfiguration);
    cfg.setSource(cfg.getConfigurationSource() + " + Magnolia-based defaultCacheConfiguration");
  }
  if (diskStorePath != null) {
    cfg.getDiskStoreConfiguration().setPath(diskStorePath);
    cfg.setSource(cfg.getConfigurationSource() + " + Magnolia-based diskStorePath");
  }
  cacheManager = new CacheManager(cfg);
  // TODO cacheManager.setName(...magnolia instance name ...);
  final MBeanServer mBeanServer = MBeanUtil.getMBeanServer();
  ManagementService.registerMBeans(cacheManager, mBeanServer, true, true, true, true);
}

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

private void configureDefaultCache() {
 final CacheConfiguration c = new CacheConfiguration();
 c.setMaxElementsInMemory(1024);
 c.setMemoryStoreEvictionPolicyFromObject(MemoryStoreEvictionPolicy.LFU);
 c.setTimeToIdleSeconds(0);
 c.setTimeToLiveSeconds(0 /* infinite */);
 c.setEternal(true);
 if (mgr.getDiskStoreConfiguration() != null) {
  c.setMaxElementsOnDisk(16384);
  c.setOverflowToDisk(false);
  c.setDiskPersistent(false);
  c.setDiskSpoolBufferSizeMB(5);
  c.setDiskExpiryThreadIntervalSeconds(60 * 60);
 }
 mgr.setDefaultCacheConfiguration(c);
}

代码示例来源: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: rtyley/mini-git-server

private void configureDefaultCache() {
 final CacheConfiguration c = new CacheConfiguration();
 c.setMaxElementsInMemory(1024);
 c.setMemoryStoreEvictionPolicyFromObject(MemoryStoreEvictionPolicy.LFU);
 c.setTimeToIdleSeconds(0);
 c.setTimeToLiveSeconds(0 /* infinite */);
 c.setEternal(true);
 if (mgr.getDiskStoreConfiguration() != null) {
  c.setMaxElementsOnDisk(16384);
  c.setOverflowToDisk(false);
  c.setDiskPersistent(false);
  c.setDiskSpoolBufferSizeMB(5);
  c.setDiskExpiryThreadIntervalSeconds(60 * 60);
 }
 mgr.setDefaultCacheConfiguration(c);
}

代码示例来源: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;
}

代码示例来源:origin: com.sitewhere/sitewhere-ehcache

@Override
public void start() throws SiteWhereException {
  LOGGER.info("Starting EHCache device management cache provider...");
  Configuration config = new Configuration();
  CacheConfiguration cacheConfig = new CacheConfiguration();
  cacheConfig.setMaxEntriesLocalHeap(100);
  cacheConfig.setTimeToLiveSeconds(60);
  config.setDefaultCacheConfiguration(cacheConfig);
  CacheManager manager = CacheManager.create(config);
  // Create site cache.
  siteCache =
      createCache(manager, ISite.class, addTenantPrefix(SITE_CACHE_ID), CacheType.SiteCache,
          getSiteCacheMaxEntries(), getSiteCacheTtl());
  // Create device specification cache.
  deviceSpecificationCache =
      createCache(manager, IDeviceSpecification.class,
          addTenantPrefix(DEVICE_SPECIFICATION_CACHE_ID), CacheType.DeviceSpecificationCache,
          getDeviceSpecificationCacheMaxEntries(), getDeviceSpecificationCacheTtl());
  // Create device cache.
  deviceCache =
      createCache(manager, IDevice.class, addTenantPrefix(DEVICE_CACHE_ID), CacheType.DeviceCache,
          getDeviceCacheMaxEntries(), getDeviceCacheTtl());
  // Create device assignment cache.
  deviceAssignmentCache =
      createCache(manager, IDeviceAssignment.class, addTenantPrefix(DEVICE_ASSIGNMENT_CACHE_ID),
          CacheType.DeviceAssignmentCache, getDeviceAssignmentCacheMaxEntries(),
          getDeviceAssignmentCacheTtl());
}

代码示例来源:origin: yrain/smart-cache

defaultCacheConfiguration.setTimeToIdleSeconds(localTimeToIdleSeconds);
defaultCacheConfiguration.setTimeToLiveSeconds(localTimeToLiveSeconds);
configuration.setDefaultCacheConfiguration(defaultCacheConfiguration);
configuration.setDynamicConfig(false);
configuration.setUpdateCheck(false);

相关文章

Configuration类方法