本文整理汇总了Java中net.sf.ehcache.config.CacheConfiguration.setMemoryStoreEvictionPolicyFromObject方法的典型用法代码示例。如果您正苦于以下问题:Java CacheConfiguration.setMemoryStoreEvictionPolicyFromObject方法的具体用法?Java CacheConfiguration.setMemoryStoreEvictionPolicyFromObject怎么用?Java CacheConfiguration.setMemoryStoreEvictionPolicyFromObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.sf.ehcache.config.CacheConfiguration
的用法示例。
在下文中一共展示了CacheConfiguration.setMemoryStoreEvictionPolicyFromObject方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCacheManager
import net.sf.ehcache.config.CacheConfiguration; //导入方法依赖的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;
}
示例2: EhcacheMap
import net.sf.ehcache.config.CacheConfiguration; //导入方法依赖的package包/类
public EhcacheMap(MemoryStoreEvictionPolicy evictionPolicy, CacheFactory builder) {
CacheConfiguration config = new CacheConfiguration(DEFAULT_CACHE_NAME, builder.maximumCapacity);
config.setMemoryStoreEvictionPolicyFromObject(evictionPolicy);
CacheManager cacheManager = new CacheManager();
cache = new Cache(config);
cache.setCacheManager(cacheManager);
cache.initialise();
}