本文整理汇总了Java中net.sf.ehcache.config.PersistenceConfiguration.strategy方法的典型用法代码示例。如果您正苦于以下问题:Java PersistenceConfiguration.strategy方法的具体用法?Java PersistenceConfiguration.strategy怎么用?Java PersistenceConfiguration.strategy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.sf.ehcache.config.PersistenceConfiguration
的用法示例。
在下文中一共展示了PersistenceConfiguration.strategy方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initCache
import net.sf.ehcache.config.PersistenceConfiguration; //导入方法依赖的package包/类
public static void initCache(String bucket) {
if (manager == null) {
load();
}
if (manager.getCache(bucket) != null) {
return;
}
CacheConfiguration config = new CacheConfiguration(bucket, 10000);
//config.setDiskPersistent(false);
//config.setMaxElementsOnDisk(0);
//config.setMaxBytesLocalDisk(0L);
config.setOverflowToOffHeap(false);
PersistenceConfiguration persistenceConfiguration = new PersistenceConfiguration();
persistenceConfiguration.strategy(PersistenceConfiguration.Strategy.NONE);
config.persistence(persistenceConfiguration);
manager.addCache(new Cache(config));
}
示例2: ehcacheTicketsCache
import net.sf.ehcache.config.PersistenceConfiguration; //导入方法依赖的package包/类
@Lazy
@Autowired
@Bean
public EhCacheFactoryBean ehcacheTicketsCache(@Qualifier("cacheManager") final CacheManager manager) {
final EhcacheProperties ehcacheProperties = casProperties.getTicket().getRegistry().getEhcache();
final EhCacheFactoryBean bean = new EhCacheFactoryBean();
bean.setCacheName(ehcacheProperties.getCacheName());
bean.setCacheEventListeners(Collections.singleton(ticketRMISynchronousCacheReplicator()));
bean.setTimeToIdle(ehcacheProperties.getCacheTimeToIdle());
bean.setTimeToLive(ehcacheProperties.getCacheTimeToLive());
bean.setCacheManager(manager);
bean.setBootstrapCacheLoader(ticketCacheBootstrapCacheLoader());
bean.setDiskExpiryThreadIntervalSeconds(ehcacheProperties.getDiskExpiryThreadIntervalSeconds());
bean.setEternal(ehcacheProperties.isEternal());
bean.setMaxEntriesLocalHeap(ehcacheProperties.getMaxElementsInMemory());
bean.setMaxEntriesInCache(ehcacheProperties.getMaxElementsInCache());
bean.setMaxEntriesLocalDisk(ehcacheProperties.getMaxElementsOnDisk());
bean.setMemoryStoreEvictionPolicy(ehcacheProperties.getMemoryStoreEvictionPolicy());
final PersistenceConfiguration c = new PersistenceConfiguration();
c.strategy(ehcacheProperties.getPersistence());
c.setSynchronousWrites(ehcacheProperties.isSynchronousWrites());
bean.persistence(c);
return bean;
}
示例3: initCache
import net.sf.ehcache.config.PersistenceConfiguration; //导入方法依赖的package包/类
public static void initCache(String bucket) {
if (manager == null) {
load();
}
if (manager.getCache(bucket) != null) {
return;
}
synchronized(manager) {
if (manager.getCache(bucket) != null) {
return;
}
CacheConfiguration config = new CacheConfiguration();
config.setName(bucket);
// We have to do this way because there is no way to programmatically configure the
// sizeOfEngine
System.setProperty("net.sf.ehcache.sizeofengine.stallionLocalMemoryCache." + bucket, "io.stallion.dataAccess.filtering.EstimatedSizeOfEngine");
// Max cache size is 100MB
config.setMaxBytesLocalHeap(100 * 1000 * 1000L);
//config.setDiskPersistent(false);
//config.setMaxElementsOnDisk(0);
//config.setMaxBytesLocalDisk(0L);
config.setOverflowToOffHeap(false);
PersistenceConfiguration persistenceConfiguration = new PersistenceConfiguration();
persistenceConfiguration.strategy(PersistenceConfiguration.Strategy.NONE);
config.persistence(persistenceConfiguration);
manager.addCache(new Cache(config));
}
}
示例4: initCache
import net.sf.ehcache.config.PersistenceConfiguration; //导入方法依赖的package包/类
public static void initCache(String bucket) {
if (manager == null) {
load();
}
if (manager.getCache(bucket) != null) {
return;
}
// We have to do this way because there is no way to programmmatically configured the
// sizeOfEngine
System.setProperty("net.sf.ehcache.sizeofengine.stallionFilterCache." + bucket, "io.stallion.dataAccess.filtering.EstimatedSizeOfEngine");
CacheConfiguration config = new CacheConfiguration();
config.setName(bucket);
// Max cache size is very approximately, 50MB
config.setMaxBytesLocalHeap(Settings.instance().getFilterCacheSize());
//config.setDiskPersistent(false);
//config.setMaxElementsOnDisk(0);
//config.setMaxBytesLocalDisk(0L);
config.setOverflowToOffHeap(false);
PersistenceConfiguration persistenceConfiguration = new PersistenceConfiguration();
persistenceConfiguration.strategy(PersistenceConfiguration.Strategy.NONE);
config.persistence(persistenceConfiguration);
//SizeOfPolicyConfiguration sizeOfPolicyConfiguration = new SizeOfPolicyConfiguration();
//sizeOfPolicyConfiguration.
//config.addSizeOfPolicy();
//config.set
Cache cache = new Cache(config);
manager.addCache(cache);
//Cache cache = manager.getCache(bucket);
//CacheConfiguration config = cache.getCacheConfiguration();
//config.setMaxBytesLocalHeap(150000000L);
}