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


Java Ignite.cache方法代码示例

本文整理汇总了Java中org.apache.ignite.Ignite.cache方法的典型用法代码示例。如果您正苦于以下问题:Java Ignite.cache方法的具体用法?Java Ignite.cache怎么用?Java Ignite.cache使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.ignite.Ignite的用法示例。


在下文中一共展示了Ignite.cache方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getGenesForChromosome

import org.apache.ignite.Ignite; //导入方法依赖的package包/类
/**
 *  
 * @param ignite
 * @param chromosome
 * @return List<Gene> 
 */
public static List<Gene> getGenesForChromosome(Ignite ignite, Chromosome chromosome) {
    List<Gene> genes = new ArrayList();
    IgniteCache<Long, Gene> cache = ignite.cache(GAGridConstants.GENE_CACHE);
    StringBuffer sbSqlClause = new StringBuffer();
    sbSqlClause.append("_key IN ");
    String sqlInClause = Arrays.toString(chromosome.getGenes());

    sqlInClause = sqlInClause.replace("[", "(");
    sqlInClause = sqlInClause.replace("]", ")");

    sbSqlClause.append(sqlInClause);

    SqlQuery sql = new SqlQuery(Gene.class, sbSqlClause.toString());

    try (QueryCursor<Entry<Long, Gene>> cursor = cache.query(sql)) {
        for (Entry<Long, Gene> e : cursor)
            genes.add(e.getValue());
    }

    return genes;
}
 
开发者ID:techbysample,项目名称:gagrid,代码行数:28,代码来源: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: IgniteOperationRepository

import org.apache.ignite.Ignite; //导入方法依赖的package包/类
@Autowired
public IgniteOperationRepository(@Qualifier("operationIgniteClient") Ignite ignite, KafkaTemplate kafkaTemplate) {
    this.ignite = ignite;
    operationCache = ignite.cache("operationCache");

    this.kafkaTemplate = kafkaTemplate;
}
 
开发者ID:kloiasoft,项目名称:eventapis,代码行数:8,代码来源:IgniteOperationRepository.java

示例4: getGenesInOrderForChromosome

import org.apache.ignite.Ignite; //导入方法依赖的package包/类
/**
 * 
 * Retrieve genes in order
 * 
 * @param ignite
 * @param chromosome
 * @return List<Gene>
 */

public static List<Gene> getGenesInOrderForChromosome(Ignite ignite, Chromosome chromosome) {
    List<Gene> genes = new ArrayList();
    IgniteCache<Long, Gene> cache = ignite.cache(GAGridConstants.GENE_CACHE);
  
    long[] primaryKeys = chromosome.getGenes();
    
    for (int k =0; k< primaryKeys.length; k++)
    {
    
      StringBuffer sbSqlClause = new StringBuffer();
      sbSqlClause.append("_key IN ");
      sbSqlClause.append("(");
      sbSqlClause.append(primaryKeys[k]);
      sbSqlClause.append(")");
      
      SqlQuery sql = new SqlQuery(Gene.class, sbSqlClause.toString());

       try (QueryCursor<Entry<Long, Gene>> cursor = cache.query(sql)) {
        for (Entry<Long, Gene> e : cursor)
            genes.add(e.getValue());
        }
    }
   
    return genes;
}
 
开发者ID:techbysample,项目名称:gagrid,代码行数:35,代码来源:GAGridUtils.java

示例5: readValuesFromCache

import org.apache.ignite.Ignite; //导入方法依赖的package包/类
Map<Integer, Integer> readValuesFromCache(Ignite ignite) {
    IgniteCache<Integer, Integer> cache = ignite.cache(CACHE_NAME);
    Set<Integer> keys = new HashSet<>();
    for (int i = startIndex; i < endIndex; i++) {
        keys.add(i);
    }
    return cache.getAll(keys);
}
 
开发者ID:epam,项目名称:Lagerta,代码行数:9,代码来源:BasicSynchronousReplicationIntegrationTest.java

示例6: writeValuesToCache

import org.apache.ignite.Ignite; //导入方法依赖的package包/类
void writeValuesToCache(Ignite ignite, boolean withReplication, int startIdx, int endIdx, int modifier) {
    try (Transaction tx = ignite.transactions().txStart()) {
        IgniteCache<Integer, Integer> cache = ignite.cache(CACHE_NAME);
        if (!withReplication) {
            cache = cache.withSkipStore();
        }
        for (int i = startIdx; i < endIdx; i++) {
            cache.put(i, i + modifier);
        }
        tx.commit();
    }
}
 
开发者ID:epam,项目名称:Lagerta,代码行数:13,代码来源:BasicSynchronousReplicationIntegrationTest.java

示例7: getAtomic

import org.apache.ignite.Ignite; //导入方法依赖的package包/类
public static <V> Atomic<V> getAtomic(Ignite ignite, String name) {
    return new CacheAtomic<>(ignite.cache(NAME), name);
}
 
开发者ID:epam,项目名称:Lagerta,代码行数:4,代码来源:AtomicsHelper.java

示例8: 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


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