本文整理了Java中net.sf.ehcache.config.Configuration.addCache()
方法的一些代码示例,展示了Configuration.addCache()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Configuration.addCache()
方法的具体详情如下:
包路径:net.sf.ehcache.config.Configuration
类名称:Configuration
方法名:addCache
[英]Allows BeanHandler to add Cache Configurations to the configuration.
[中]允许BeanHandler将缓存配置添加到配置中。
代码示例来源:origin: jooby-project/jooby
ccache = ((ConfigObject) value).toConfig();
ehconfig.addCache(new CacheConfigurationBuilder(cname).build(ccache.withFallback(defcache)));
代码示例来源:origin: net.sf.ehcache/ehcache
/**
* Builder to add a new cache through its config
*
* @return this configuration instance
* @throws ObjectExistsException
* if a cache with the same name already exists, or if the name conflicts with the name of the default cache
*/
public final Configuration cache(CacheConfiguration cacheConfiguration) throws ObjectExistsException {
addCache(cacheConfiguration);
return this;
}
代码示例来源:origin: net.sf.ehcache/ehcache
/**
* Allows BeanHandler to add Cache Configurations to the configuration.
*/
public final void addCache(CacheConfiguration cacheConfiguration) throws ObjectExistsException {
addCache(cacheConfiguration, true);
}
代码示例来源:origin: net.sf.ehcache/ehcache
private void registerCacheConfiguration(final CacheManager cacheManager) {
Map<String, CacheConfiguration> configMap = cacheManager.getConfiguration().getCacheConfigurations();
if (!configMap.containsKey(getName())) {
cacheManager.getConfiguration().addCache(this, false);
}
}
代码示例来源:origin: org.sonatype.nexus.bundles/org.sonatype.nexus.bundles.ehcache
/**
* Allows BeanHandler to add Cache Configurations to the configuration.
*/
public final void addCache(CacheConfiguration cacheConfiguration) throws ObjectExistsException {
addCache(cacheConfiguration, true);
}
代码示例来源:origin: net.sf.ehcache.internal/ehcache-core
/**
* Builder to add a new cache through its config
*
* @return this configuration instance
* @throws ObjectExistsException
* if a cache with the same name already exists, or if the name conflicts with the name of the default cache
*/
public final Configuration cache(CacheConfiguration cacheConfiguration) throws ObjectExistsException {
addCache(cacheConfiguration);
return this;
}
代码示例来源:origin: org.sonatype.nexus.bundles/org.sonatype.nexus.bundles.ehcache
/**
* Builder to add a new cache through its config
*
* @return this configuration instance
* @throws ObjectExistsException
* if a cache with the same name already exists, or if the name conflicts with the name of the default cache
*/
public final Configuration cache(CacheConfiguration cacheConfiguration) throws ObjectExistsException {
addCache(cacheConfiguration);
return this;
}
代码示例来源:origin: net.sf.ehcache.internal/ehcache-core
/**
* Allows BeanHandler to add Cache Configurations to the configuration.
*/
public final void addCache(CacheConfiguration cacheConfiguration) throws ObjectExistsException {
addCache(cacheConfiguration, true);
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.ehcache
/**
* Builder to add a new cache through its config
*
* @return this configuration instance
* @throws ObjectExistsException
* if a cache with the same name already exists, or if the name conflicts with the name of the default cache
*/
public final Configuration cache(CacheConfiguration cacheConfiguration) throws ObjectExistsException {
addCache(cacheConfiguration);
return this;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.ehcache
/**
* Allows BeanHandler to add Cache Configurations to the configuration.
*/
public final void addCache(CacheConfiguration cacheConfiguration) throws ObjectExistsException {
addCache(cacheConfiguration, true);
}
代码示例来源:origin: net.sf.ehcache.internal/ehcache-core
private void registerCacheConfiguration(final CacheManager cacheManager) {
Map<String, CacheConfiguration> configMap = cacheManager.getConfiguration().getCacheConfigurations();
if (!configMap.containsKey(getName())) {
cacheManager.getConfiguration().addCache(this, false);
}
}
代码示例来源:origin: org.sonatype.nexus.bundles/org.sonatype.nexus.bundles.ehcache
private void registerCacheConfiguration(final CacheManager cacheManager) {
Map<String, CacheConfiguration> configMap = cacheManager.getConfiguration().getCacheConfigurations();
if (!configMap.containsKey(getName())) {
cacheManager.getConfiguration().addCache(this, false);
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.ehcache
private void registerCacheConfiguration(final CacheManager cacheManager) {
Map<String, CacheConfiguration> configMap = cacheManager.getConfiguration().getCacheConfigurations();
if (!configMap.containsKey(getName())) {
cacheManager.getConfiguration().addCache(this, false);
}
}
代码示例来源:origin: gustavoorsi/e-learning
@Bean(destroyMethod = "shutdown")
public net.sf.ehcache.CacheManager ehCacheManager() {
CacheConfiguration cacheConfiguration = new CacheConfiguration();
cacheConfiguration.setName("restApiAuthTokenCache");
cacheConfiguration.setMemoryStoreEvictionPolicy("LRU");
cacheConfiguration.setMaxEntriesLocalHeap(0); // 0 = MAX
cacheConfiguration.setTimeToLiveSeconds(14400); // 4 hours.
cacheConfiguration.setEternal(false);
net.sf.ehcache.config.Configuration config = new net.sf.ehcache.config.Configuration();
config.addCache(cacheConfiguration);
return net.sf.ehcache.CacheManager.newInstance(config);
}
代码示例来源:origin: Yorubaname/yorubaname-website
@Bean
public net.sf.ehcache.CacheManager ecacheManager() {
CacheConfiguration allNames = new CacheConfiguration();
allNames.setName("allNames");
allNames.setMaxEntriesLocalHeap(0);
allNames.setEternal(false);
allNames.setTimeToIdleSeconds(1800);
CacheConfiguration querySearchResult = new CacheConfiguration();
querySearchResult.setName("querySearchResult");
querySearchResult.setMaxEntriesLocalHeap(0);
querySearchResult.setEternal(false);
querySearchResult.setTimeToIdleSeconds(1800);
CacheConfiguration names = new CacheConfiguration();
names.setName("names");
names.setMaxEntriesLocalHeap(0);
names.setEternal(false);
names.setTimeToIdleSeconds(1800);
net.sf.ehcache.config.Configuration config = new net.sf.ehcache.config.Configuration();
config.addCache(allNames);
config.addCache(querySearchResult);
config.addCache(names);
return net.sf.ehcache.CacheManager.newInstance(config);
}
代码示例来源:origin: FINRAOS/herd
/**
* Gets an EH Cache manager.
*
* @return the EH Cache manager.
*/
@Bean(destroyMethod = "shutdown")
public net.sf.ehcache.CacheManager ehCacheManager()
{
CacheConfiguration cacheConfiguration = new CacheConfiguration();
cacheConfiguration.setName(HERD_CACHE_NAME);
cacheConfiguration.setTimeToLiveSeconds(configurationHelper.getProperty(ConfigurationValue.HERD_CACHE_TIME_TO_LIVE_SECONDS, Long.class));
cacheConfiguration.setTimeToIdleSeconds(configurationHelper.getProperty(ConfigurationValue.HERD_CACHE_TIME_TO_IDLE_SECONDS, Long.class));
cacheConfiguration.setMaxElementsInMemory(configurationHelper.getProperty(ConfigurationValue.HERD_CACHE_MAX_ELEMENTS_IN_MEMORY, Integer.class));
cacheConfiguration.setMemoryStoreEvictionPolicy(configurationHelper.getProperty(ConfigurationValue.HERD_CACHE_MEMORY_STORE_EVICTION_POLICY));
net.sf.ehcache.config.Configuration config = new net.sf.ehcache.config.Configuration();
config.addCache(cacheConfiguration);
return net.sf.ehcache.CacheManager.create(config);
}
代码示例来源:origin: hburgmeier/jerseyoauth2
public DefaultCacheManagerProvider()
{
net.sf.ehcache.config.Configuration config = new net.sf.ehcache.config.Configuration();
config.setUpdateCheck(false);
CacheConfiguration tokenCacheConfiguration = new CacheConfiguration().
maxEntriesLocalHeap(DEFAULT_MAX_CACHE_ENTRIES).
name("tokenCache").
persistence(new PersistenceConfiguration().strategy(Strategy.NONE));
tokenCacheConfiguration.validateConfiguration();
config.addCache(tokenCacheConfiguration );
cacheManager = CacheManager.create(config);
}
代码示例来源:origin: org.finra.herd/herd-dao
/**
* Gets an EH Cache manager.
*
* @return the EH Cache manager.
*/
@Bean(destroyMethod = "shutdown")
public net.sf.ehcache.CacheManager ehCacheManager()
{
CacheConfiguration cacheConfiguration = new CacheConfiguration();
cacheConfiguration.setName(HERD_CACHE_NAME);
cacheConfiguration.setTimeToLiveSeconds(configurationHelper.getProperty(ConfigurationValue.HERD_CACHE_TIME_TO_LIVE_SECONDS, Long.class));
cacheConfiguration.setTimeToIdleSeconds(configurationHelper.getProperty(ConfigurationValue.HERD_CACHE_TIME_TO_IDLE_SECONDS, Long.class));
cacheConfiguration.setMaxElementsInMemory(configurationHelper.getProperty(ConfigurationValue.HERD_CACHE_MAX_ELEMENTS_IN_MEMORY, Integer.class));
cacheConfiguration.setMemoryStoreEvictionPolicy(configurationHelper.getProperty(ConfigurationValue.HERD_CACHE_MEMORY_STORE_EVICTION_POLICY));
net.sf.ehcache.config.Configuration config = new net.sf.ehcache.config.Configuration();
config.addCache(cacheConfiguration);
return net.sf.ehcache.CacheManager.create(config);
}
代码示例来源:origin: rtyley/mini-git-server
Configuration toConfiguration() {
configureDiskStore();
configureDefaultCache();
for (CacheProvider<?, ?> p : caches.values()) {
final String name = p.getName();
final CacheConfiguration c = newCache(name);
c.setMemoryStoreEvictionPolicyFromObject(toPolicy(p.evictionPolicy()));
c.setMaxElementsInMemory(getInt(name, "memorylimit", p.memoryLimit()));
c.setTimeToIdleSeconds(0);
c.setTimeToLiveSeconds(getSeconds(name, "maxage", p.maxAge()));
c.setEternal(c.getTimeToLiveSeconds() == 0);
if (p.disk() && mgr.getDiskStoreConfiguration() != null) {
c.setMaxElementsOnDisk(getInt(name, "disklimit", p.diskLimit()));
int v = c.getDiskSpoolBufferSizeMB() * MB;
v = getInt(name, "diskbuffer", v) / MB;
c.setDiskSpoolBufferSizeMB(Math.max(1, v));
c.setOverflowToDisk(c.getMaxElementsOnDisk() > 0);
c.setDiskPersistent(c.getMaxElementsOnDisk() > 0);
}
mgr.addCache(c);
}
return mgr;
}
代码示例来源:origin: com.madgag/mini-git-server-server
Configuration toConfiguration() {
configureDiskStore();
configureDefaultCache();
for (CacheProvider<?, ?> p : caches.values()) {
final String name = p.getName();
final CacheConfiguration c = newCache(name);
c.setMemoryStoreEvictionPolicyFromObject(toPolicy(p.evictionPolicy()));
c.setMaxElementsInMemory(getInt(name, "memorylimit", p.memoryLimit()));
c.setTimeToIdleSeconds(0);
c.setTimeToLiveSeconds(getSeconds(name, "maxage", p.maxAge()));
c.setEternal(c.getTimeToLiveSeconds() == 0);
if (p.disk() && mgr.getDiskStoreConfiguration() != null) {
c.setMaxElementsOnDisk(getInt(name, "disklimit", p.diskLimit()));
int v = c.getDiskSpoolBufferSizeMB() * MB;
v = getInt(name, "diskbuffer", v) / MB;
c.setDiskSpoolBufferSizeMB(Math.max(1, v));
c.setOverflowToDisk(c.getMaxElementsOnDisk() > 0);
c.setDiskPersistent(c.getMaxElementsOnDisk() > 0);
}
mgr.addCache(c);
}
return mgr;
}
内容来源于网络,如有侵权,请联系作者删除!