本文整理汇总了Java中org.apache.ignite.Ignite.getOrCreateCache方法的典型用法代码示例。如果您正苦于以下问题:Java Ignite.getOrCreateCache方法的具体用法?Java Ignite.getOrCreateCache怎么用?Java Ignite.getOrCreateCache使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.ignite.Ignite
的用法示例。
在下文中一共展示了Ignite.getOrCreateCache方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getChromosomes
import org.apache.ignite.Ignite; //导入方法依赖的package包/类
/**
* Retrieve chromosomes
*
* @param ignite
* @param query
* @return
*/
public static List<Chromosome> getChromosomes(Ignite ignite, String query)
{
List<Chromosome> chromosomes = new ArrayList();
IgniteCache<Long, Chromosome> populationCache = ignite.getOrCreateCache(PopulationCacheConfig.populationCache());
SqlQuery sql = new SqlQuery(Chromosome.class, query);
try (QueryCursor<Entry<Long, Chromosome>> cursor = populationCache.query(sql)) {
for (Entry<Long, Chromosome> e : cursor)
chromosomes.add(e.getValue());
}
return chromosomes;
}
示例2: getReference
import org.apache.ignite.Ignite; //导入方法依赖的package包/类
public static <V> Reference<V> getReference(Ignite ignite, final String name, boolean create) {
final IgniteCache<Object, Object> cache = create ? ignite.getOrCreateCache(NAME) : ignite.cache(NAME);
return new Reference<V>() {
@Override
public V get() {
return cache == null ? null : (V) cache.get(name);
}
@Override
public void set(V value) {
if (value == null) {
cache.remove(name);
} else {
cache.put(name, value);
}
}
};
}
示例3: MemorySpatialIndexSegment
import org.apache.ignite.Ignite; //导入方法依赖的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
}
示例4: MemoryHashIndexSegment
import org.apache.ignite.Ignite; //导入方法依赖的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
}
示例5: applyUpdates
import org.apache.ignite.Ignite; //导入方法依赖的package包/类
/**
* Apply updates to caches.
*
* @param ignite Ignite instance.
*/
void applyUpdates(Ignite ignite) {
for (Map.Entry<String, Map> entry : updates.entrySet()) {
IgniteCache<Object, Object> cache = ignite.getOrCreateCache(entry.getKey());
cache.putAll(entry.getValue());
}
}
示例6: runServer
import org.apache.ignite.Ignite; //导入方法依赖的package包/类
private static void runServer() throws Exception {
System.setProperty("IGNITE_QUIET", "false");
Ignite ignite = Ignition.start(IgniteConfig.getIgniteConfig(false));
IgniteCache<Long, EntityWithMapField> cache = ignite.getOrCreateCache(IgniteConfig.CACHE_NAME);
Map<String, String> attrs = new HashMap<>(2);
attrs.put("1", "one");
attrs.put("2", "two");
cache.put(1L, new EntityWithMapField(attrs));
System.out.println(cache.get(1L));
}
示例7: getReference
import org.apache.ignite.Ignite; //导入方法依赖的package包/类
public static <V> Reference<V> getReference(Ignite ignite, final String name, boolean create) {
final IgniteCache<Object, Object> cache = create ? ignite.getOrCreateCache(NAME) : ignite.cache(NAME);
return new CacheReference<>(cache, name);
}
示例8: cache
import org.apache.ignite.Ignite; //导入方法依赖的package包/类
/** */
private IgniteCache<K, V> cache(Ignite ignite) {
return ignite.getOrCreateCache(cacheName);
}
开发者ID:Luodian,项目名称:Higher-Cloud-Computing-Project,代码行数:5,代码来源:CacheColumnDecisionTreeTrainerInput.java
示例9: getOrCreate
import org.apache.ignite.Ignite; //导入方法依赖的package包/类
/**
* Get or create cache for training context.
*
* @param ignite Ignite instance.
* @param <D> Class storing information about continuous regions.
* @return Cache for training context.
*/
public static <D extends ContinuousRegionInfo> IgniteCache<UUID, TrainingContext<D>> getOrCreate(Ignite ignite) {
CacheConfiguration<UUID, TrainingContext<D>> cfg = new CacheConfiguration<>();
cfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
cfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
cfg.setEvictionPolicy(null);
cfg.setCopyOnRead(false);
cfg.setCacheMode(CacheMode.REPLICATED);
cfg.setOnheapCacheEnabled(true);
cfg.setReadFromBackup(true);
cfg.setName(COLUMN_DECISION_TREE_TRAINER_CONTEXT_CACHE_NAME);
return ignite.getOrCreateCache(cfg);
}
示例10: createNew
import org.apache.ignite.Ignite; //导入方法依赖的package包/类
/**
* Create new labeled vectors cache.
*
* @param ignite Ignite instance.
* @return new labeled vectors cache.
*/
public static IgniteCache<Integer, LabeledVector<Vector, Vector>> createNew(Ignite ignite) {
CacheConfiguration<Integer, LabeledVector<Vector, Vector>> cfg = new CacheConfiguration<>();
// Write to primary.
cfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.PRIMARY_SYNC);
// Atomic transactions only.
cfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
// No copying of values.
cfg.setCopyOnRead(false);
// Cache is partitioned.
cfg.setCacheMode(CacheMode.PARTITIONED);
cfg.setBackups(0);
cfg.setOnheapCacheEnabled(true);
cfg.setName("LBLD_VECS_" + UUID.randomUUID().toString());
return ignite.getOrCreateCache(cfg);
}
示例11: getOrCreate
import org.apache.ignite.Ignite; //导入方法依赖的package包/类
/**
* Get or create region projections cache.
*
* @param ignite Ignite instance.
* @return Region projections cache.
*/
public static IgniteCache<UUID, MLPGroupUpdateTrainingData> getOrCreate(Ignite ignite) {
CacheConfiguration<UUID, MLPGroupUpdateTrainingData> cfg = new CacheConfiguration<>();
// Write to primary.
cfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.PRIMARY_SYNC);
// Atomic transactions only.
cfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
// No copying of values.
cfg.setCopyOnRead(false);
// Cache is partitioned.
cfg.setCacheMode(CacheMode.REPLICATED);
cfg.setBackups(0);
cfg.setOnheapCacheEnabled(true);
cfg.setName(CACHE_NAME);
return ignite.getOrCreateCache(cfg);
}
示例12: getOrCreate
import org.apache.ignite.Ignite; //导入方法依赖的package包/类
/**
* Get or create region projections cache.
*
* @param ignite Ignite instance.
* @return Region projections cache.
*/
public static IgniteCache<GroupTrainerCacheKey<Void>, MLPGroupTrainingCacheValue> getOrCreate(Ignite ignite) {
CacheConfiguration<GroupTrainerCacheKey<Void>, MLPGroupTrainingCacheValue> cfg = new CacheConfiguration<>();
// Write to primary.
cfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.PRIMARY_SYNC);
// Atomic transactions only.
cfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
// No copying of values.
cfg.setCopyOnRead(false);
// Cache is partitioned.
cfg.setCacheMode(CacheMode.PARTITIONED);
cfg.setBackups(0);
cfg.setOnheapCacheEnabled(true);
cfg.setName(CACHE_NAME);
return ignite.getOrCreateCache(cfg);
}
示例13: getOrCreate
import org.apache.ignite.Ignite; //导入方法依赖的package包/类
/**
* Create new projections cache for ColumnDecisionTreeTrainer if needed.
*
* @param ignite Ignite instance.
*/
public static IgniteCache<FeatureKey, double[]> getOrCreate(Ignite ignite) {
CacheConfiguration<FeatureKey, double[]> cfg = new CacheConfiguration<>();
// Write to primary.
cfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.PRIMARY_SYNC);
// Atomic transactions only.
cfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
// No eviction.
cfg.setEvictionPolicy(null);
// No copying of values.
cfg.setCopyOnRead(false);
// Cache is partitioned.
cfg.setCacheMode(CacheMode.PARTITIONED);
cfg.setOnheapCacheEnabled(true);
cfg.setBackups(0);
cfg.setName(COLUMN_DECISION_TREE_TRAINER_FEATURES_CACHE_NAME);
return ignite.getOrCreateCache(cfg);
}
示例14: getOrCreate
import org.apache.ignite.Ignite; //导入方法依赖的package包/类
/**
* Get or create splits cache.
*
* @param ignite Ignite instance.
* @return Splits cache.
*/
public static IgniteCache<SplitKey, IgniteBiTuple<Integer, Double>> getOrCreate(Ignite ignite) {
CacheConfiguration<SplitKey, IgniteBiTuple<Integer, Double>> cfg = new CacheConfiguration<>();
// Write to primary.
cfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.PRIMARY_SYNC);
// Atomic transactions only.
cfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
// No eviction.
cfg.setEvictionPolicy(null);
// No copying of values.
cfg.setCopyOnRead(false);
// Cache is partitioned.
cfg.setCacheMode(CacheMode.PARTITIONED);
cfg.setBackups(0);
cfg.setOnheapCacheEnabled(true);
cfg.setName(CACHE_NAME);
return ignite.getOrCreateCache(cfg);
}
示例15: getOrCreate
import org.apache.ignite.Ignite; //导入方法依赖的package包/类
/**
* Get or create region projections cache.
*
* @param ignite Ignite instance.
* @return Region projections cache.
*/
public static IgniteCache<RegionKey, List<RegionProjection>> getOrCreate(Ignite ignite) {
CacheConfiguration<RegionKey, List<RegionProjection>> cfg = new CacheConfiguration<>();
// Write to primary.
cfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.PRIMARY_SYNC);
// Atomic transactions only.
cfg.setAtomicityMode(CacheAtomicityMode.ATOMIC);
// No eviction.
cfg.setEvictionPolicy(null);
// No copying of values.
cfg.setCopyOnRead(false);
// Cache is partitioned.
cfg.setCacheMode(CacheMode.PARTITIONED);
cfg.setBackups(0);
cfg.setOnheapCacheEnabled(true);
cfg.setName(CACHE_NAME);
return ignite.getOrCreateCache(cfg);
}