本文整理汇总了Java中org.apache.ignite.configuration.CacheConfiguration.setCacheStoreFactory方法的典型用法代码示例。如果您正苦于以下问题:Java CacheConfiguration.setCacheStoreFactory方法的具体用法?Java CacheConfiguration.setCacheStoreFactory怎么用?Java CacheConfiguration.setCacheStoreFactory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.ignite.configuration.CacheConfiguration
的用法示例。
在下文中一共展示了CacheConfiguration.setCacheStoreFactory方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createCache
import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
* Creates cache with full configuration. Active store is used.
*
* @param cacheName name of cache.
* @param atomicityMode atomicity.
* @param cacheMode mode.
* @param writeBehindEnabled should write behind be used for active store.
* @param flushFreq flush frequency for write behind.
* @param base configuration to copy settings from.
* @param <K> type of key.
* @param <V> type of value
* @return cache instance.
*/
@SuppressWarnings("unchecked")
public <K, V> IgniteCache<K, V> createCache(String cacheName, CacheAtomicityMode atomicityMode, CacheMode cacheMode,
boolean writeBehindEnabled, int flushFreq,
CacheConfiguration<K, V> base) {
CacheConfiguration<K, V> realConfiguration = base == null
? new CacheConfiguration<K, V>()
: new CacheConfiguration<K, V>(base);
realConfiguration.setName(cacheName);
realConfiguration.setAtomicityMode(atomicityMode);
realConfiguration.setCacheMode(cacheMode);
realConfiguration.setBackups(2);
realConfiguration.setWriteThrough(true);
realConfiguration.setReadThrough(true);
realConfiguration.setWriteBehindEnabled(writeBehindEnabled);
realConfiguration.setWriteBehindFlushFrequency(flushFreq);
realConfiguration.setCacheStoreFactory(activeStoreConfiguration.activeCacheStoreFactory());
return ignite().createCache(realConfiguration);
}
示例2: MemorySpatialIndexSegment
import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
public MemorySpatialIndexSegment(String uniqueName, SpatialPartitioner
partitioner, long batchUpdateTimeMilliseconds, StreamDataset
stream, Attribute indexedAttribute)
{
this.setName(uniqueName);
this.spatialPartitioner = partitioner;
this.stream = stream;
this.indexedAttribute = indexedAttribute;
//Index creation
//Setting index configuration
CacheConfiguration<Integer,SpatialPartition> cnfig = new
CacheConfiguration<> (this.getName());
cnfig.setCacheMode(CacheMode.LOCAL);
cnfig.setCacheStoreFactory(new IgniteReflectionFactory<BulkLoadSpatialCacheStore>
(BulkLoadSpatialCacheStore.class));
cnfig.setWriteThrough(true);
Ignite cluster = KiteInstance.getCluster(); //getting underlying cluster
spatialPartitionsData = cluster.getOrCreateCache(cnfig); //create
}
示例3: MemoryHashIndexSegment
import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
public MemoryHashIndexSegment(String uniqueName, long
batchUpdateTimeMilliseconds) {
this.setName(uniqueName);
//Index creation
//Setting index configuration
CacheConfiguration<String,ArrayList<Long>> cnfig = new
CacheConfiguration<String,ArrayList<Long>>(this.getName());
cnfig.setCacheMode(CacheMode.LOCAL);
cnfig.setCacheStoreFactory(new IgniteReflectionFactory<BulkLoadCacheStore>
(BulkLoadCacheStore.class));
cnfig.setWriteThrough(true);
Ignite cluster = KiteInstance.getCluster(); //getting underlying cluster
hashIndex = cluster.getOrCreateCache(cnfig); //create index
}
示例4: buildCacheConfigurationRestricted
import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/** */
private CacheConfiguration buildCacheConfigurationRestricted(String cacheName, boolean readThrough,
boolean interceptor, boolean hasQueryEntity) {
CacheConfiguration cfg = new CacheConfiguration<Integer, Person>()
.setName(cacheName)
.setCacheMode(CacheMode.PARTITIONED)
.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
if (readThrough) {
cfg.setCacheStoreFactory(singletonFactory(new TestStore()));
cfg.setReadThrough(true);
}
if (interceptor)
cfg.setInterceptor(new TestInterceptor());
if (hasQueryEntity) {
cfg.setQueryEntities(F.asList(new QueryEntity(Integer.class, Person.class)
.setNotNullFields(Collections.singleton("name"))));
}
return cfg;
}
示例5: createCacheConfiguration
import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
* @param atomicityMode Atomicity mode.
* @return Cache configuration.
*/
@SuppressWarnings({"rawtypes", "unchecked"})
private CacheConfiguration<String, List<Double>> createCacheConfiguration(CacheAtomicityMode atomicityMode) {
CacheConfiguration<String, List<Double>> cc = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
cc.setCacheMode(PARTITIONED);
cc.setAtomicityMode(atomicityMode);
cc.setWriteSynchronizationMode(FULL_SYNC);
cc.setReadThrough(true);
cc.setWriteThrough(true);
Factory cacheStoreFactory = new FactoryBuilder.SingletonFactory(new DummyCacheStore());
cc.setCacheStoreFactory(cacheStoreFactory);
cc.setBackups(2);
return cc;
}
示例6: 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;
}
示例7: cacheConfiguration
import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
* @return Cache configuration.
*/
@NotNull private CacheConfiguration cacheConfiguration() {
CacheConfiguration cacheCfg = defaultCacheConfiguration();
cacheCfg.setName(CACHE_NAME);
cacheCfg.setCacheMode(cacheMode());
cacheCfg.setAtomicityMode(atomicityMode());
cacheCfg.setNearConfiguration(nearConfiguration());
cacheCfg.setRebalanceMode(ASYNC);
cacheCfg.setWriteSynchronizationMode(FULL_SYNC);
cacheCfg.setCacheStoreFactory(new StoreFactory());
cacheCfg.setReadThrough(true);
cacheCfg.setWriteThrough(true);
cacheCfg.setLoadPreviousValue(true);
return cacheCfg;
}
示例8: cacheConfiguration
import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override protected CacheConfiguration cacheConfiguration(String igniteInstanceName) throws Exception {
CacheConfiguration cfg = super.cacheConfiguration(igniteInstanceName);
cfg.setCacheStoreFactory(null);
cfg.setReadThrough(false);
cfg.setWriteThrough(false);
cfg.setBackups(1);
if (cfg.getCacheMode() == REPLICATED)
cfg.setAffinity(null);
else
cfg.setAffinity(new RendezvousAffinityFunction(false, 32));
return cfg;
}
示例9: prepareConfig
import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private static <K, V> IgniteConfiguration prepareConfig(HBaseCacheStoreSessionListener cssl,
HBaseCacheStore<K, V> cs, boolean writeBehind) {
IgniteConfiguration cfg = new IgniteConfiguration();
CacheConfiguration<K, V> cacheCfg = new CacheConfiguration<>();
cacheCfg.setWriteThrough(true);
cacheCfg.setWriteBehindEnabled(writeBehind);
cacheCfg.setReadThrough(true);
cacheCfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
cacheCfg.setCacheStoreFactory(FactoryBuilder.factoryOf(cs));
cacheCfg.setCacheStoreSessionListenerFactories(FactoryBuilder.factoryOf(cssl));
cfg.setCacheConfiguration(cacheCfg);
return cfg;
}
示例10: 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.setCacheStoreFactory(null);
ccfg.setReadThrough(false);
ccfg.setWriteThrough(false);
return ccfg;
}
示例11: getConfiguration
import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
TransactionConfiguration txCfg = c.getTransactionConfiguration();
txCfg.setDefaultTxConcurrency(txConcurrency);
txCfg.setDefaultTxIsolation(txIsolation);
txCfg.setTxSerializableEnabled(true);
CacheConfiguration cc = defaultCacheConfiguration();
cc.setCacheMode(cacheMode());
cc.setAtomicityMode(TRANSACTIONAL);
cc.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
cc.setEvictionPolicy(plc);
cc.setOnheapCacheEnabled(true);
if (testStore != null) {
cc.setCacheStoreFactory(singletonFactory(testStore));
cc.setReadThrough(true);
cc.setWriteThrough(true);
cc.setLoadPreviousValue(true);
}
else
cc.setCacheStoreFactory(null);
c.setCacheConfiguration(cc);
TcpDiscoverySpi disco = new TcpDiscoverySpi();
disco.setIpFinder(ipFinder);
c.setDiscoverySpi(disco);
return c;
}
示例12: getConfiguration
import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
cfg.setPeerClassLoadingEnabled(peerClassLoadingEnabled());
if (!igniteInstanceName.equals(NO_CACHE_IGNITE_INSTANCE_NAME)) {
CacheConfiguration cacheCfg = defaultCacheConfiguration();
cacheCfg.setCacheMode(cacheMode());
cacheCfg.setAtomicityMode(atomicityMode());
cacheCfg.setNearConfiguration(nearConfiguration());
cacheCfg.setRebalanceMode(ASYNC);
cacheCfg.setWriteSynchronizationMode(FULL_SYNC);
cacheCfg.setCacheStoreFactory(new StoreFactory());
cacheCfg.setReadThrough(true);
cacheCfg.setWriteThrough(true);
cacheCfg.setLoadPreviousValue(true);
cfg.setCacheConfiguration(cacheCfg);
}
else
cfg.setClientMode(true);
TcpDiscoverySpi disco = new TcpDiscoverySpi();
disco.setIpFinder(IP_FINDER);
cfg.setDiscoverySpi(disco);
((TcpCommunicationSpi)cfg.getCommunicationSpi()).setSharedMemoryPort(-1);
return cfg;
}
示例13: 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 discoSpi = new TcpDiscoverySpi();
discoSpi.setIpFinder(IP_FINDER);
cfg.setDiscoverySpi(discoSpi);
GridCacheGenericTestStore<String, Integer> store = new GridCacheGenericTestStore<>();
stores.add(store);
CacheConfiguration cacheCfg = defaultCacheConfiguration();
cacheCfg.setCacheMode(PARTITIONED);
cacheCfg.setBackups(1);
cacheCfg.setCacheStoreFactory(singletonFactory(store));
cacheCfg.setReadThrough(true);
cacheCfg.setWriteThrough(true);
cacheCfg.setLoadPreviousValue(true);
cacheCfg.setAtomicityMode(TRANSACTIONAL);
cacheCfg.setNearConfiguration(new NearCacheConfiguration());
cfg.setCacheConfiguration(cacheCfg);
return cfg;
}
示例14: cacheConfiguration
import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
* @param cacheMode Cache mode.
* @param syncMode Write synchronization mode.
* @param backups Number of backups.
* @param storeEnabled If {@code true} adds cache store.
* @param nearCache If {@code true} near cache is enabled.
* @return Cache configuration.
*/
private CacheConfiguration<Integer, Integer> cacheConfiguration(
CacheMode cacheMode,
CacheWriteSynchronizationMode syncMode,
int backups,
boolean storeEnabled,
boolean nearCache) {
CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
ccfg.setCacheMode(cacheMode);
ccfg.setAtomicityMode(TRANSACTIONAL);
ccfg.setWriteSynchronizationMode(syncMode);
if (cacheMode == PARTITIONED)
ccfg.setBackups(backups);
if (storeEnabled) {
ccfg.setCacheStoreFactory(new TestStoreFactory());
ccfg.setWriteThrough(true);
ccfg.setReadThrough(true);
}
if (nearCache)
ccfg.setNearConfiguration(new NearCacheConfiguration<Integer, Integer>());
return ccfg;
}
示例15: loadExternalClassesToCfg
import org.apache.ignite.configuration.CacheConfiguration; //导入方法依赖的package包/类
/**
*
* @param cacheCfg Configuration.
*/
private void loadExternalClassesToCfg(CacheConfiguration cacheCfg) {
try {
Object sf = getExternalClassLoader().
loadClass("org.apache.ignite.tests.p2p.CacheDeploymentTestStoreFactory").newInstance();
cacheCfg.setCacheStoreFactory((Factory)sf);
Object sslf = getExternalClassLoader().
loadClass("org.apache.ignite.tests.p2p.CacheDeploymentStoreSessionListenerFactory").newInstance();
cacheCfg.setCacheStoreSessionListenerFactories((Factory)sslf);
Object cpc = getExternalClassLoader().
loadClass("org.apache.ignite.tests.p2p.CacheDeploymentCachePluginConfiguration").newInstance();
cacheCfg.setPluginConfigurations((CachePluginConfiguration)cpc);
Object akm = getExternalClassLoader().
loadClass("org.apache.ignite.tests.p2p.CacheDeploymentAffinityKeyMapper").newInstance();
cacheCfg.setAffinityMapper((AffinityKeyMapper)akm);
Object pred = getExternalClassLoader().
loadClass("org.apache.ignite.tests.p2p.CacheDeploymentAlwaysTruePredicate2").newInstance();
cacheCfg.setNodeFilter((IgnitePredicate)pred);
}
catch (Exception e) {
throw new RuntimeException(e);
}
}