本文整理汇总了Java中org.apache.ignite.configuration.CacheConfiguration.setLoadPreviousValue方法的典型用法代码示例。如果您正苦于以下问题:Java CacheConfiguration.setLoadPreviousValue方法的具体用法?Java CacheConfiguration.setLoadPreviousValue怎么用?Java CacheConfiguration.setLoadPreviousValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.ignite.configuration.CacheConfiguration
的用法示例。
在下文中一共展示了CacheConfiguration.setLoadPreviousValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getConfiguration
import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
TcpDiscoverySpi disco = new TcpDiscoverySpi();
disco.setIpFinder(new TcpDiscoveryVmIpFinder(true));
cfg.setDiscoverySpi(disco);
CacheConfiguration ccfg = defaultCacheConfiguration();
ccfg.setName("test-cache");
ccfg.setCacheMode(LOCAL);
ccfg.setCacheStoreFactory(singletonFactory(new TestStore()));
ccfg.setReadThrough(true);
ccfg.setWriteThrough(true);
ccfg.setLoadPreviousValue(true);
cfg.setCacheConfiguration(ccfg);
return cfg;
}
示例2: cacheConfiguration
import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
* @return Cache configuration.
* @throws Exception If failed.
*/
protected CacheConfiguration cacheConfiguration() throws Exception {
CacheConfiguration cc = defaultCacheConfiguration();
cc.setCacheMode(PARTITIONED);
cc.setAtomicityMode(ATOMIC);
cc.setWriteBehindEnabled(false);
cc.setCacheStoreFactory(singletonFactory(store));
cc.setReadThrough(true);
cc.setWriteThrough(true);
cc.setLoadPreviousValue(true);
return cc;
}
示例3: getConfiguration
import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
CacheConfiguration ccfg = defaultCacheConfiguration();
ccfg.setCacheMode(PARTITIONED);
ccfg.setBackups(1);
ccfg.setCacheStoreFactory(singletonFactory(new TestStore()));
ccfg.setReadThrough(true);
ccfg.setWriteThrough(true);
ccfg.setLoadPreviousValue(true);
ccfg.setWriteSynchronizationMode(FULL_SYNC);
cfg.setCacheConfiguration(ccfg);
TcpDiscoverySpi disco = new TcpDiscoverySpi();
disco.setIpFinder(IP_FINDER);
cfg.setDiscoverySpi(disco);
return cfg;
}
示例4: cacheConfiguration
import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
* @return Cache configuration.
*/
@SuppressWarnings("unchecked")
protected CacheConfiguration cacheConfiguration() {
CacheConfiguration cc = defaultCacheConfiguration();
// Template
cc.setName("*");
cc.setRebalanceMode(SYNC);
cc.setCacheStoreFactory(singletonFactory(store));
cc.setReadThrough(true);
cc.setWriteThrough(true);
cc.setLoadPreviousValue(true);
cc.setStoreKeepBinary(true);
cc.setCacheMode(cacheMode());
cc.setWriteSynchronizationMode(cacheWriteSynchronizationMode());
cc.setBackups(0);
cc.setAtomicityMode(CacheAtomicityMode.ATOMIC);
return cc;
}
示例5: createCacheConfig
import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
* @return Cache configuration with basic settings.
*/
@SuppressWarnings("unchecked")
private CacheConfiguration createCacheConfig() {
CacheConfiguration cacheCfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
cacheCfg.setCacheMode(cacheMode());
cacheCfg.setAtomicityMode(atomicityMode());
cacheCfg.setNearConfiguration(nearConfiguration());
cacheCfg.setWriteSynchronizationMode(FULL_SYNC);
cacheCfg.setReadThrough(true);
cacheCfg.setWriteThrough(true);
cacheCfg.setLoadPreviousValue(true);
cacheCfg.setBackups(1);
cacheCfg.setOnheapCacheEnabled(false);
return cacheCfg;
}
示例6: getConfiguration
import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override protected final IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
TcpDiscoverySpi disco = new TcpDiscoverySpi();
disco.setIpFinder(IP_FINDER);
c.setDiscoverySpi(disco);
CacheConfiguration cc = defaultCacheConfiguration();
cc.setCacheMode(cacheMode());
cc.setWriteSynchronizationMode(FULL_SYNC);
cc.setAtomicityMode(atomicityMode());
cc.setRebalanceMode(SYNC);
cc.setCacheStoreFactory(singletonFactory(store));
cc.setReadThrough(true);
cc.setWriteThrough(true);
cc.setLoadPreviousValue(true);
c.setCacheConfiguration(cc);
return c;
}
示例7: getConfiguration
import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
TcpDiscoverySpi spi = new TcpDiscoverySpi();
spi.setIpFinder(ipFinder);
cfg.setDiscoverySpi(spi);
CacheConfiguration cacheCfg = defaultCacheConfiguration();
cacheCfg.setCacheMode(PARTITIONED);
cacheCfg.setNearConfiguration(null);
cacheCfg.setAffinity(new RendezvousAffinityFunction(false, 30));
cacheCfg.setBackups(1);
cacheCfg.setWriteSynchronizationMode(FULL_SYNC);
if (storeEnabled) {
cacheCfg.setCacheStoreFactory(singletonFactory(new GridCacheTestStore()));
cacheCfg.setReadThrough(true);
cacheCfg.setWriteThrough(true);
cacheCfg.setLoadPreviousValue(true);
}
else
cacheCfg.setCacheStoreFactory(null);
cfg.setCacheConfiguration(cacheCfg);
return cfg;
}
示例8: cacheConfiguration
import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
* @param cacheName Cache name.
* @return Cache configuration.
* @throws Exception In case of error.
*/
@SuppressWarnings("unchecked")
private static CacheConfiguration cacheConfiguration(@NotNull final String cacheName) throws Exception {
CacheConfiguration cfg = defaultCacheConfiguration();
cfg.setCacheMode(DEFAULT_CACHE_NAME.equals(cacheName) || CACHE_NAME.equals(cacheName) ? LOCAL : "replicated".equals(cacheName) ?
REPLICATED : PARTITIONED);
cfg.setName(cacheName);
cfg.setWriteSynchronizationMode(FULL_SYNC);
cfg.setCacheStoreFactory(new Factory<CacheStore>() {
@Override public CacheStore create() {
synchronized (cacheStores) {
HashMapStore cacheStore = cacheStores.get(cacheName);
if (cacheStore == null)
cacheStores.put(cacheName, cacheStore = new HashMapStore());
return cacheStore;
}
}
});
cfg.setWriteThrough(true);
cfg.setReadThrough(true);
cfg.setLoadPreviousValue(true);
if (cfg.getCacheMode() == PARTITIONED)
cfg.setBackups(1);
return cfg;
}
示例9: getConfiguration
import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override protected final IgniteConfiguration getConfiguration() throws Exception {
IgniteConfiguration c = super.getConfiguration();
TcpDiscoverySpi disco = new TcpDiscoverySpi();
disco.setIpFinder(new TcpDiscoveryVmIpFinder(true));
c.setDiscoverySpi(disco);
CacheConfiguration cc = defaultCacheConfiguration();
cc.setCacheMode(cacheMode());
cc.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
cc.setAtomicityMode(TRANSACTIONAL);
cc.setCacheStoreFactory(singletonFactory(store));
cc.setReadThrough(true);
cc.setWriteThrough(true);
cc.setLoadPreviousValue(true);
cc.setWriteBehindEnabled(true);
cc.setWriteBehindFlushFrequency(WRITE_FROM_BEHIND_FLUSH_FREQUENCY);
c.setCacheConfiguration(cc);
return c;
}
示例10: 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;
}
示例11: getConfiguration
import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override protected final IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
TcpDiscoverySpi disco = new TcpDiscoverySpi();
disco.setIpFinder(IP_FINDER);
c.setDiscoverySpi(disco);
CacheConfiguration cc = defaultCacheConfiguration();
cc.setCacheMode(PARTITIONED);
cc.setWriteSynchronizationMode(FULL_SYNC);
cc.setAtomicityMode(TRANSACTIONAL);
cc.setBackups(1);
cc.setCacheStoreFactory(new StoreFactory());
cc.setReadThrough(true);
cc.setWriteThrough(true);
cc.setLoadPreviousValue(true);
cc.setNearConfiguration(nearCacheConfiguration());
c.setCacheConfiguration(cc);
return c;
}
示例12: cacheConfiguration
import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
* @return Cache configuration.
*/
@SuppressWarnings("unchecked")
private CacheConfiguration cacheConfiguration() {
CacheConfiguration cfg = defaultCacheConfiguration();
cfg.setCacheMode(PARTITIONED);
cfg.setBackups(1);
cfg.setCacheStoreFactory(singletonFactory(store));
cfg.setReadThrough(true);
cfg.setWriteThrough(true);
cfg.setLoadPreviousValue(true);
cfg.setWriteSynchronizationMode(FULL_SYNC);
return cfg;
}
示例13: getConfiguration
import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override protected final IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
TcpDiscoverySpi disco = new TcpDiscoverySpi();
disco.setIpFinder(IP_FINDER);
c.setDiscoverySpi(disco);
if (!client) {
CacheConfiguration cc = defaultCacheConfiguration();
cc.setCacheMode(PARTITIONED);
cc.setWriteSynchronizationMode(FULL_SYNC);
cc.setAtomicityMode(TRANSACTIONAL);
cc.setBackups(1);
cc.setCacheStoreFactory(new TestStoreFactory());
cc.setReadThrough(true);
cc.setWriteThrough(true);
cc.setLoadPreviousValue(true);
c.setCacheConfiguration(cc);
}
else
c.setClientMode(true);
return c;
}
示例14: 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();
if (storeStgy != null) {
Factory<? extends CacheStore<Object, Object>> storeFactory = storeStgy.getStoreFactory();
CacheStore<?, ?> store = storeFactory.create();
if (store != null) {
cfg.setCacheStoreFactory(storeFactory);
cfg.setReadThrough(true);
cfg.setWriteThrough(true);
cfg.setLoadPreviousValue(true);
storeStgy.updateCacheConfiguration(cfg);
}
}
cfg.setCacheMode(cacheMode());
cfg.setAtomicityMode(atomicityMode());
cfg.setWriteSynchronizationMode(writeSynchronization());
cfg.setNearConfiguration(nearConfiguration());
cfg.setOnheapCacheEnabled(onheapCacheEnabled());
Class<?>[] idxTypes = indexedTypes();
if (!F.isEmpty(idxTypes))
cfg.setIndexedTypes(idxTypes);
if (cacheMode() == PARTITIONED)
cfg.setBackups(1);
return cfg;
}
示例15: getConfiguration
import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
cfg.setLocalHost("127.0.0.1");
TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
discoSpi.setIpFinder(IP_FINDER);
cfg.setDiscoverySpi(discoSpi);
CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
ccfg.setName(CACHE_NAME);
ccfg.setCacheMode(PARTITIONED);
ccfg.setAtomicityMode(TRANSACTIONAL);
ccfg.setNearConfiguration(new NearCacheConfiguration());
ccfg.setRebalanceMode(SYNC);
ccfg.setWriteSynchronizationMode(FULL_SYNC);
ccfg.setBackups(BACKUP_CNT);
ccfg.setCacheStoreFactory(singletonFactory(store));
ccfg.setReadThrough(true);
ccfg.setWriteThrough(true);
ccfg.setLoadPreviousValue(true);
cfg.setCacheConfiguration(ccfg);
return cfg;
}