本文整理汇总了Java中org.apache.ignite.configuration.CacheConfiguration.setCacheLoaderFactory方法的典型用法代码示例。如果您正苦于以下问题:Java CacheConfiguration.setCacheLoaderFactory方法的具体用法?Java CacheConfiguration.setCacheLoaderFactory怎么用?Java CacheConfiguration.setCacheLoaderFactory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.ignite.configuration.CacheConfiguration
的用法示例。
在下文中一共展示了CacheConfiguration.setCacheLoaderFactory方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: IgniteCacheAdapter
import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
* Constructor.
*
* @param id
* Cache id.
*/
@SuppressWarnings("unchecked")
public IgniteCacheAdapter(String id) {
if (id == null) {
throw new IllegalArgumentException("Cache instances require an ID");
}
CacheConfiguration<Object, Object> cacheCfg = null;
try {
DefaultListableBeanFactory factory = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(factory).loadBeanDefinitions(new FileSystemResource(new File(CFG_PATH)));
cacheCfg = (CacheConfiguration<Object, Object>) factory.getBean("templateCacheCfg");
cacheCfg.setEvictionPolicy(null);
cacheCfg.setCacheLoaderFactory(null);
cacheCfg.setCacheWriterFactory(null);
// overrides template cache name with the specified id.
cacheCfg.setName(id);
} catch (NoSuchBeanDefinitionException | BeanDefinitionStoreException e) {
// initializes the default cache.
log.warn("Initializing the default cache. Consider properly configuring '" + CFG_PATH + "' instead.");
log.trace("" + e);
cacheCfg = new CacheConfiguration<>(id);
}
cache = ignite.getOrCreateCache(cacheCfg);
this.id = id;
}
示例2: cacheConfiguration
import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
* @param igniteInstanceName Ignite instance name.
* @return Cache configuration.
* @throws Exception In case of error.
*/
@SuppressWarnings("unchecked")
protected CacheConfiguration cacheConfiguration(String igniteInstanceName) throws Exception {
CacheConfiguration cfg = defaultCacheConfiguration();
cfg.setCacheMode(cacheMode());
cfg.setAtomicityMode(atomicityMode());
cfg.setWriteSynchronizationMode(writeSynchronization());
cfg.setNearConfiguration(nearConfiguration());
cfg.setCacheLoaderFactory(loaderFactory());
if (cfg.getCacheLoaderFactory() != null)
cfg.setReadThrough(true);
cfg.setCacheWriterFactory(writerFactory());
if (cfg.getCacheWriterFactory() != null)
cfg.setWriteThrough(true);
Factory<CacheStore> storeFactory = cacheStoreFactory();
if (storeFactory != null) {
cfg.setCacheStoreFactory(storeFactory);
cfg.setReadThrough(true);
cfg.setWriteThrough(true);
cfg.setLoadPreviousValue(true);
cfg.setWriteBehindEnabled(writeBehindEnabled());
cfg.setWriteBehindCoalescing(writeBehindCoalescing());
}
if (cacheMode() == PARTITIONED)
cfg.setBackups(1);
cfg.setOnheapCacheEnabled(onheapCacheEnabled());
return cfg;
}
示例3: cacheConfiguration
import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override protected CacheConfiguration cacheConfiguration(String igniteInstanceName) throws Exception {
CacheConfiguration ccfg = super.cacheConfiguration(igniteInstanceName);
ccfg.setWriteThrough(writeThrough);
ccfg.setCacheLoaderFactory(new CacheLoaderFactory());
ccfg.setCacheWriterFactory(new CacheWriterFactory());
return ccfg;
}