本文整理了Java中net.sf.ehcache.config.Configuration.getDefaultCacheConfiguration()
方法的一些代码示例,展示了Configuration.getDefaultCacheConfiguration()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Configuration.getDefaultCacheConfiguration()
方法的具体详情如下:
包路径:net.sf.ehcache.config.Configuration
类名称:Configuration
方法名:getDefaultCacheConfiguration
暂无
代码示例来源:origin: hibernate/hibernate-orm
if ( config.getDefaultCacheConfiguration() != null
&& config.getDefaultCacheConfiguration().isTerracottaClustered() ) {
setupHibernateTimeoutBehavior(
config.getDefaultCacheConfiguration()
.getTerracottaConfiguration()
.getNonstopConfiguration()
代码示例来源:origin: net.sf.ehcache/ehcache
/**
* @return the Default Cache
* @throws net.sf.ehcache.CacheException if there is no default cache
*/
public final Ehcache createDefaultCache() throws CacheException {
CacheConfiguration cacheConfiguration = configuration.getDefaultCacheConfiguration();
if (cacheConfiguration == null) {
return null;
} else {
cacheConfiguration.name = Cache.DEFAULT_CACHE_NAME;
return createCache(cacheConfiguration);
}
}
代码示例来源:origin: net.sf.ehcache/ehcache
/**
* Creates decorated ehcaches for the cache, if any configured in ehcache.xml
*
* @param cache the cache
* @return List of the decorated ehcaches, if any configured in ehcache.xml otherwise returns empty list
*/
public List<Ehcache> createCacheDecorators(Ehcache cache) {
CacheConfiguration cacheConfiguration = cache.getCacheConfiguration();
if (cacheConfiguration == null) {
return createDefaultCacheDecorators(cache, configuration.getDefaultCacheConfiguration(), loader);
}
List<CacheDecoratorFactoryConfiguration> cacheDecoratorConfigurations = cacheConfiguration.getCacheDecoratorConfigurations();
if (cacheDecoratorConfigurations == null || cacheDecoratorConfigurations.size() == 0) {
LOG.debug("CacheDecoratorFactory not configured. Skipping for '" + cache.getName() + "'.");
return createDefaultCacheDecorators(cache, configuration.getDefaultCacheConfiguration(), loader);
}
List<Ehcache> result = new ArrayList<Ehcache>();
for (CacheDecoratorFactoryConfiguration factoryConfiguration : cacheDecoratorConfigurations) {
Ehcache decoratedCache = createDecoratedCache(cache, factoryConfiguration, false, loader);
if (decoratedCache != null) {
result.add(decoratedCache);
}
}
for (Ehcache defaultDecoratedCache : createDefaultCacheDecorators(cache, configuration.getDefaultCacheConfiguration(), loader)) {
result.add(defaultDecoratedCache);
}
return result;
}
代码示例来源:origin: net.sf.ehcache/ehcache
private List<Ehcache> createDefaultCacheDecorators(Ehcache underlyingCache) {
return ConfigurationHelper.createDefaultCacheDecorators(underlyingCache, runtimeCfg.getConfiguration()
.getDefaultCacheConfiguration(), getClassLoader());
}
代码示例来源:origin: net.sf.ehcache/ehcache
/**
* Create a cache manager configuration from the supplied url, correcting it for Hibernate compatibility.
* <p>
* Currently correcting for Hibernate compatibility means simply switching any identity based value modes to serialization.
*/
static Configuration loadAndCorrectConfiguration(URL url) {
Configuration config = ConfigurationFactory.parseConfiguration(url);
if (config.getDefaultCacheConfiguration() != null
&& config.getDefaultCacheConfiguration().isTerracottaClustered()) {
setupHibernateTimeoutBehavior(config.getDefaultCacheConfiguration().getTerracottaConfiguration().getNonstopConfiguration());
}
for (CacheConfiguration cacheConfig : config.getCacheConfigurations().values()) {
if (cacheConfig.isTerracottaClustered()) {
setupHibernateTimeoutBehavior(cacheConfig.getTerracottaConfiguration().getNonstopConfiguration());
}
}
return config;
}
代码示例来源:origin: org.sonatype.nexus.bundles/org.sonatype.nexus.bundles.ehcache
/**
* @return the Default Cache
* @throws net.sf.ehcache.CacheException if there is no default cache
*/
public final Ehcache createDefaultCache() throws CacheException {
CacheConfiguration cacheConfiguration = configuration.getDefaultCacheConfiguration();
if (cacheConfiguration == null) {
return null;
} else {
cacheConfiguration.name = Cache.DEFAULT_CACHE_NAME;
return createCache(cacheConfiguration);
}
}
代码示例来源:origin: net.sf.ehcache/ehcache
testAddCacheManagerPeerListenerFactoryElement();
addChildElement(new DefaultCacheConfigurationElement(this, configuration, configuration.getDefaultCacheConfiguration()));
代码示例来源:origin: net.sf.ehcache.internal/ehcache-core
/**
* @return the Default Cache
* @throws net.sf.ehcache.CacheException if there is no default cache
*/
public final Ehcache createDefaultCache() throws CacheException {
CacheConfiguration cacheConfiguration = configuration.getDefaultCacheConfiguration();
if (cacheConfiguration == null) {
return null;
} else {
cacheConfiguration.name = Cache.DEFAULT_CACHE_NAME;
return createCache(cacheConfiguration);
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.ehcache
/**
* @return the Default Cache
* @throws net.sf.ehcache.CacheException if there is no default cache
*/
public final Ehcache createDefaultCache() throws CacheException {
CacheConfiguration cacheConfiguration = configuration.getDefaultCacheConfiguration();
if (cacheConfiguration == null) {
return null;
} else {
cacheConfiguration.name = Cache.DEFAULT_CACHE_NAME;
return createCache(cacheConfiguration);
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.ehcache
private List<Ehcache> createDefaultCacheDecorators(Ehcache underlyingCache) {
return ConfigurationHelper.createDefaultCacheDecorators(underlyingCache, runtimeCfg.getConfiguration().getDefaultCacheConfiguration());
}
代码示例来源:origin: org.sakaiproject.kernel/sakai-kernel-impl
@Override
public Properties getProperties() {
Configuration ec = cacheManager.getConfiguration();
Properties p = new Properties();
p.put("name", ec.getName());
p.put("source", ec.getConfigurationSource().toString());
p.put("timeoutSeconds", ec.getDefaultTransactionTimeoutInSeconds());
p.put("maxBytesDisk", ec.getMaxBytesLocalDisk());
p.put("maxBytesHeap", ec.getMaxBytesLocalHeap());
p.put("maxDepth", ec.getSizeOfPolicyConfiguration().getMaxDepth());
p.put("defaultCacheMaxEntries", ec.getDefaultCacheConfiguration().getMaxEntriesLocalHeap());
p.put("defaultCacheTimeToIdleSecs", ec.getDefaultCacheConfiguration().getTimeToIdleSeconds());
p.put("defaultCacheTimeToLiveSecs", ec.getDefaultCacheConfiguration().getTimeToLiveSeconds());
p.put("defaultCacheEternal", ec.getDefaultCacheConfiguration().isEternal());
return p;
}
代码示例来源:origin: rtyley/mini-git-server
private CacheConfiguration newCache(final String name) {
try {
final CacheConfiguration c;
c = mgr.getDefaultCacheConfiguration().clone();
c.setName(name);
return c;
} catch (CloneNotSupportedException e) {
throw new ProvisionException("Cannot configure cache " + name, e);
}
}
}
代码示例来源:origin: com.madgag/mini-git-server-server
private CacheConfiguration newCache(final String name) {
try {
final CacheConfiguration c;
c = mgr.getDefaultCacheConfiguration().clone();
c.setName(name);
return c;
} catch (CloneNotSupportedException e) {
throw new ProvisionException("Cannot configure cache " + name, e);
}
}
}
代码示例来源:origin: org.sonatype.nexus.bundles/org.sonatype.nexus.bundles.ehcache
private List<Ehcache> createDefaultCacheDecorators(Ehcache underlyingCache) {
return ConfigurationHelper.createDefaultCacheDecorators(underlyingCache, runtimeCfg.getConfiguration()
.getDefaultCacheConfiguration(), getClassLoader());
}
代码示例来源:origin: net.sf.ehcache.internal/ehcache-core
private List<Ehcache> createDefaultCacheDecorators(Ehcache underlyingCache) {
return ConfigurationHelper.createDefaultCacheDecorators(underlyingCache, runtimeCfg.getConfiguration()
.getDefaultCacheConfiguration(), getClassLoader());
}
代码示例来源:origin: com.atlassian.jira/jira-core
static CacheManager workAroundCache95(CacheManager ehCacheManager)
{
final CacheConfiguration defaultConfig = ehCacheManager.getConfiguration().getDefaultCacheConfiguration();
final CacheConfiguration.CacheEventListenerFactoryConfiguration listenerConfig =
new CacheConfiguration.CacheEventListenerFactoryConfiguration()
.className(NoopCacheEventListenerFactory.class.getName());
defaultConfig.clone().addCacheEventListenerFactory(listenerConfig);
if (defaultConfig.getCacheEventListenerConfigurations().isEmpty())
{
LOG.warn("It looks like CACHE-95 has been fixed. This workaround should be removed.");
}
else
{
LOG.debug("Working around CACHE-95");
}
return ehCacheManager;
}
代码示例来源:origin: apache/cxf
public static CacheConfiguration getCacheConfiguration(String key, CacheManager cacheManager) {
CacheConfiguration cc = cacheManager.getConfiguration().getCacheConfigurations().get(key);
if (cc == null && key.contains("-")) {
cc = cacheManager.getConfiguration().getCacheConfigurations().get(
key.substring(0, key.lastIndexOf('-') - 1));
}
if (cc == null) {
cc = cacheManager.getConfiguration().getDefaultCacheConfiguration();
}
if (cc == null) {
cc = new CacheConfiguration();
} else {
cc = cc.clone();
}
cc.setName(key);
return cc;
}
代码示例来源:origin: apache/cxf
public static CacheConfiguration getCacheConfiguration(String key, CacheManager cacheManager) {
CacheConfiguration cc = cacheManager.getConfiguration().getCacheConfigurations().get(key);
if (cc == null && key.contains("-")) {
cc = cacheManager.getConfiguration().getCacheConfigurations().get(
key.substring(0, key.lastIndexOf('-') - 1));
}
if (cc == null) {
cc = cacheManager.getConfiguration().getDefaultCacheConfiguration();
}
if (cc == null) {
cc = new CacheConfiguration();
} else {
cc = cc.clone();
}
cc.setName(key);
return cc;
}
代码示例来源:origin: net.sf.ehcache.internal/ehcache-core
/**
* Create a cache manager configuration from the supplied url, correcting it for Hibernate compatibility.
* <p>
* Currently correcting for Hibernate compatibility means simply switching any identity based value modes to serialization.
*/
static Configuration loadAndCorrectConfiguration(URL url) {
Configuration config = ConfigurationFactory.parseConfiguration(url);
if (config.getDefaultCacheConfiguration() != null
&& config.getDefaultCacheConfiguration().isTerracottaClustered()) {
setupHibernateTimeoutBehavior(config.getDefaultCacheConfiguration().getTerracottaConfiguration().getNonstopConfiguration());
}
for (CacheConfiguration cacheConfig : config.getCacheConfigurations().values()) {
if (cacheConfig.isTerracottaClustered()) {
setupHibernateTimeoutBehavior(cacheConfig.getTerracottaConfiguration().getNonstopConfiguration());
}
}
return config;
}
代码示例来源:origin: io.github.hengyunabc/mybatis-ehcache-spring
@Override
public Cache getCache(String id) {
if (id == null) {
throw new IllegalArgumentException("Cache instances require an ID");
}
if (!cacheManager.cacheExists(id)) {
CacheConfiguration temp = null;
if (cacheConfiguration != null) {
temp = cacheConfiguration.clone();
} else {
// based on defaultCache
temp = cacheManager.getConfiguration().getDefaultCacheConfiguration().clone();
}
temp.setName(id);
net.sf.ehcache.Cache cache = new net.sf.ehcache.Cache(temp);
cacheManager.addCache(cache);
}
return new EhcacheCache(id, cacheManager.getEhcache(id));
}
内容来源于网络,如有侵权,请联系作者删除!