当前位置: 首页>>代码示例>>Java>>正文


Java Ignite.getOrCreateCache方法代码示例

本文整理汇总了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;
}
 
开发者ID:techbysample,项目名称:gagrid,代码行数:23,代码来源:GAGridUtils.java

示例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);
            }
        }
    };
}
 
开发者ID:epam,项目名称:Lagerta,代码行数:19,代码来源:MetadataAtomicsHelper.java

示例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
}
 
开发者ID:amrmagdy4,项目名称:kite,代码行数:23,代码来源:MemorySpatialIndexSegment.java

示例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
}
 
开发者ID:amrmagdy4,项目名称:kite,代码行数:18,代码来源:MemoryHashIndexSegment.java

示例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());
    }
}
 
开发者ID:Luodian,项目名称:Higher-Cloud-Computing-Project,代码行数:13,代码来源:ResultAndUpdates.java

示例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));
}
 
开发者ID:symbicator,项目名称:apache-ignite-cassandra1,代码行数:17,代码来源:IgniteServerRunner.java

示例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);
}
 
开发者ID:epam,项目名称:Lagerta,代码行数:5,代码来源:AtomicsHelper.java

示例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);
}
 
开发者ID:Luodian,项目名称:Higher-Cloud-Computing-Project,代码行数:29,代码来源:ContextCache.java

示例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);
}
 
开发者ID:Luodian,项目名称:Higher-Cloud-Computing-Project,代码行数:30,代码来源:LabeledVectorsCache.java

示例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);
}
 
开发者ID:Luodian,项目名称:Higher-Cloud-Computing-Project,代码行数:30,代码来源:MLPGroupUpdateTrainerDataCache.java

示例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);
}
 
开发者ID:Luodian,项目名称:Higher-Cloud-Computing-Project,代码行数:30,代码来源:MLPCache.java

示例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);
}
 
开发者ID:Luodian,项目名称:Higher-Cloud-Computing-Project,代码行数:32,代码来源:FeaturesCache.java

示例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);
}
 
开发者ID:Luodian,项目名称:Higher-Cloud-Computing-Project,代码行数:33,代码来源:SplitCache.java

示例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);
}
 
开发者ID:Luodian,项目名称:Higher-Cloud-Computing-Project,代码行数:33,代码来源:ProjectionsCache.java


注:本文中的org.apache.ignite.Ignite.getOrCreateCache方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。