本文整理了Java中net.sf.ehcache.config.Configuration.setMaxBytesLocalHeap()
方法的一些代码示例,展示了Configuration.setMaxBytesLocalHeap()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Configuration.setMaxBytesLocalHeap()
方法的具体详情如下:
包路径:net.sf.ehcache.config.Configuration
类名称:Configuration
方法名:setMaxBytesLocalHeap
[英]Sets the maximum amount of bytes the cache manager being configured will use on the OnHeap tier
[中]
代码示例来源:origin: apache/kylin
conf.setMaxBytesLocalHeap("100M");
CacheManager cacheManager = CacheManager.create(conf);
代码示例来源:origin: net.sf.ehcache/ehcache
/**
* Sets the maxOnHeap size for the cache being configured
* @param amount the amount of unit
* @param memoryUnit the actual unit
* @return this
* @see #setMaxBytesLocalHeap(Long)
*/
public Configuration maxBytesLocalHeap(final long amount, final MemoryUnit memoryUnit) {
setMaxBytesLocalHeap(memoryUnit.toBytes(amount));
return this;
}
代码示例来源:origin: net.sf.ehcache/ehcache
/**
* {@inheritDoc}
*/
public void setMaxBytesLocalHeap(long maxBytes) {
try {
cacheManager.getConfiguration().setMaxBytesLocalHeap(maxBytes);
} catch (RuntimeException e) {
throw Utils.newPlainException(e);
}
}
代码示例来源:origin: net.sf.ehcache/ehcache
/**
* {@inheritDoc}
*/
public void setMaxBytesLocalHeapAsString(String maxBytes) {
try {
cacheManager.getConfiguration().setMaxBytesLocalHeap(maxBytes);
} catch (RuntimeException e) {
throw Utils.newPlainException(e);
}
}
代码示例来源:origin: net.sf.ehcache/ehcache
/**
* Sets maximum amount of bytes the CacheManager will use on the Disk Tier.
* @param maxBytesOnHeap String representation of the size.
* @see MemoryUnit#parseSizeInBytes(String)
*/
public void setMaxBytesLocalHeap(final String maxBytesOnHeap) {
assertArgumentNotNull("MaxBytesLocalHeap", maxBytesOnHeap);
final String origInput = maxBytesLocalHeapInput;
try {
maxBytesLocalHeapInput = maxBytesOnHeap;
if (isPercentage(maxBytesOnHeap)) {
long maxMemory = Runtime.getRuntime().maxMemory();
long mem = maxMemory / HUNDRED * parsePercentage(maxBytesOnHeap);
setMaxBytesLocalHeap(mem);
} else {
setMaxBytesLocalHeap(MemoryUnit.parseSizeInBytes(maxBytesOnHeap));
}
} catch (RuntimeException rte) {
maxBytesLocalHeapInput = origInput;
throw rte;
}
}
代码示例来源:origin: net.sf.ehcache.internal/ehcache-core
/**
* Sets the maxOnHeap size for the cache being configured
* @param amount the amount of unit
* @param memoryUnit the actual unit
* @return this
* @see #setMaxBytesLocalHeap(Long)
*/
public Configuration maxBytesLocalHeap(final long amount, final MemoryUnit memoryUnit) {
setMaxBytesLocalHeap(memoryUnit.toBytes(amount));
return this;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.ehcache
/**
* Sets the maxOnHeap size for the cache being configured
* @param amount the amount of unit
* @param memoryUnit the actual unit
* @return this
* @see #setMaxBytesLocalHeap(Long)
*/
public Configuration maxBytesLocalHeap(final long amount, final MemoryUnit memoryUnit) {
setMaxBytesLocalHeap(memoryUnit.toBytes(amount));
return this;
}
代码示例来源:origin: org.sonatype.nexus.bundles/org.sonatype.nexus.bundles.ehcache
/**
* Sets the maxOnHeap size for the cache being configured
* @param amount the amount of unit
* @param memoryUnit the actual unit
* @return this
* @see #setMaxBytesLocalHeap(Long)
*/
public Configuration maxBytesLocalHeap(final long amount, final MemoryUnit memoryUnit) {
setMaxBytesLocalHeap(memoryUnit.toBytes(amount));
return this;
}
代码示例来源:origin: org.sonatype.nexus.bundles/org.sonatype.nexus.bundles.ehcache
/**
* {@inheritDoc}
*/
public void setMaxBytesLocalHeapAsString(String maxBytes) {
try {
cacheManager.getConfiguration().setMaxBytesLocalHeap(maxBytes);
} catch (RuntimeException e) {
throw Utils.newPlainException(e);
}
}
代码示例来源:origin: net.sf.ehcache.internal/ehcache-core
/**
* {@inheritDoc}
*/
public void setMaxBytesLocalHeap(long maxBytes) {
try {
cacheManager.getConfiguration().setMaxBytesLocalHeap(maxBytes);
} catch (RuntimeException e) {
throw Utils.newPlainException(e);
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.ehcache
/**
* {@inheritDoc}
*/
public void setMaxBytesLocalHeap(long maxBytes) {
try {
cacheManager.getConfiguration().setMaxBytesLocalHeap(maxBytes);
} catch (RuntimeException e) {
throw Utils.newPlainException(e);
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.ehcache
/**
* {@inheritDoc}
*/
public void setMaxBytesLocalHeapAsString(String maxBytes) {
try {
cacheManager.getConfiguration().setMaxBytesLocalHeap(maxBytes);
} catch (RuntimeException e) {
throw Utils.newPlainException(e);
}
}
代码示例来源:origin: net.sf.ehcache.internal/ehcache-core
/**
* {@inheritDoc}
*/
public void setMaxBytesLocalHeapAsString(String maxBytes) {
try {
cacheManager.getConfiguration().setMaxBytesLocalHeap(maxBytes);
} catch (RuntimeException e) {
throw Utils.newPlainException(e);
}
}
代码示例来源:origin: org.sonatype.nexus.bundles/org.sonatype.nexus.bundles.ehcache
/**
* {@inheritDoc}
*/
public void setMaxBytesLocalHeap(long maxBytes) {
try {
cacheManager.getConfiguration().setMaxBytesLocalHeap(maxBytes);
} catch (RuntimeException e) {
throw Utils.newPlainException(e);
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.ehcache
/**
* Sets maximum amount of bytes the CacheManager will use on the Disk Tier.
* @param maxBytesOnHeap String representation of the size.
* @see MemoryUnit#parseSizeInBytes(String)
*/
public void setMaxBytesLocalHeap(final String maxBytesOnHeap) {
assertArgumentNotNull("MaxBytesLocalHeap", maxBytesOnHeap);
if (isPercentage(maxBytesOnHeap)) {
long maxMemory = Runtime.getRuntime().maxMemory();
long mem = maxMemory / HUNDRED * parsePercentage(maxBytesOnHeap);
setMaxBytesLocalHeap(mem);
} else {
setMaxBytesLocalHeap(MemoryUnit.parseSizeInBytes(maxBytesOnHeap));
}
maxBytesLocalHeapInput = maxBytesOnHeap;
}
代码示例来源:origin: org.sonatype.nexus.bundles/org.sonatype.nexus.bundles.ehcache
/**
* Sets maximum amount of bytes the CacheManager will use on the Disk Tier.
* @param maxBytesOnHeap String representation of the size.
* @see MemoryUnit#parseSizeInBytes(String)
*/
public void setMaxBytesLocalHeap(final String maxBytesOnHeap) {
assertArgumentNotNull("MaxBytesLocalHeap", maxBytesOnHeap);
final String origInput = maxBytesLocalHeapInput;
try {
maxBytesLocalHeapInput = maxBytesOnHeap;
if (isPercentage(maxBytesOnHeap)) {
long maxMemory = Runtime.getRuntime().maxMemory();
long mem = maxMemory / HUNDRED * parsePercentage(maxBytesOnHeap);
setMaxBytesLocalHeap(mem);
} else {
setMaxBytesLocalHeap(MemoryUnit.parseSizeInBytes(maxBytesOnHeap));
}
} catch (RuntimeException rte) {
maxBytesLocalHeapInput = origInput;
throw rte;
}
}
代码示例来源:origin: net.sf.ehcache.internal/ehcache-core
/**
* Sets maximum amount of bytes the CacheManager will use on the Disk Tier.
* @param maxBytesOnHeap String representation of the size.
* @see MemoryUnit#parseSizeInBytes(String)
*/
public void setMaxBytesLocalHeap(final String maxBytesOnHeap) {
assertArgumentNotNull("MaxBytesLocalHeap", maxBytesOnHeap);
final String origInput = maxBytesLocalHeapInput;
try {
maxBytesLocalHeapInput = maxBytesOnHeap;
if (isPercentage(maxBytesOnHeap)) {
long maxMemory = Runtime.getRuntime().maxMemory();
long mem = maxMemory / HUNDRED * parsePercentage(maxBytesOnHeap);
setMaxBytesLocalHeap(mem);
} else {
setMaxBytesLocalHeap(MemoryUnit.parseSizeInBytes(maxBytesOnHeap));
}
} catch (RuntimeException rte) {
maxBytesLocalHeapInput = origInput;
throw rte;
}
}
代码示例来源:origin: org.geotools/gt-s3-geotiff
private static CacheManager buildCache(CacheConfig config) {
CacheManager manager;
if (config.getConfigurationPath() != null) {
manager = CacheManager.newInstance(config.getConfigurationPath());
} else {
Configuration cacheConfig = new Configuration();
cacheConfig.setMaxBytesLocalDisk((long) config.getDiskCacheSize());
cacheConfig.setMaxBytesLocalHeap((long) config.getHeapSize());
CacheConfiguration defaultCacheConfiguration =
new CacheConfiguration()
.persistence(
new PersistenceConfiguration()
.strategy(
PersistenceConfiguration.Strategy
.LOCALTEMPSWAP));
cacheConfig.defaultCache(defaultCacheConfiguration);
if (config.isUseDiskCache()) {
DiskStoreConfiguration diskConfig = new DiskStoreConfiguration();
diskConfig.setPath(config.getCacheDirectory().toAbsolutePath().toString());
cacheConfig.diskStore(diskConfig);
}
manager = new CacheManager(cacheConfig);
manager.addCache(DEFAULT_CACHE);
Cache cache = manager.getCache(DEFAULT_CACHE);
SelfPopulatingCache populatingCache =
new SelfPopulatingCache(cache, new S3ChunkEntryFactory(config));
manager.replaceCacheWithDecoratedCache(cache, populatingCache);
}
return manager;
}
代码示例来源:origin: yrain/smart-cache
Configuration configuration = new Configuration();
configuration.setName(Cache.ID);
configuration.setMaxBytesLocalHeap(localMaxBytesLocalHeap);
configuration.setMaxBytesLocalDisk(localMaxBytesLocalDisk);
内容来源于网络,如有侵权,请联系作者删除!