org.apache.ignite.Ignite.addCacheConfiguration()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(3.1k)|赞(0)|评价(0)|浏览(161)

本文整理了Java中org.apache.ignite.Ignite.addCacheConfiguration()方法的一些代码示例,展示了Ignite.addCacheConfiguration()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ignite.addCacheConfiguration()方法的具体详情如下:
包路径:org.apache.ignite.Ignite
类名称:Ignite
方法名:addCacheConfiguration

Ignite.addCacheConfiguration介绍

[英]Adds cache configuration template.
[中]添加缓存配置模板。

代码示例

代码示例来源:origin: apache/ignite

/** {@inheritDoc} */
@Override public <K, V> void addCacheConfiguration(CacheConfiguration<K, V> cacheCfg) {
  checkIgnite();
  g.addCacheConfiguration(cacheCfg);
}

代码示例来源:origin: apache/ignite

@Override public Void call() throws Exception {
    int node = idx.getAndIncrement() % GRID_CNT;
    Ignite ignite = grid(node);
    log.info("Add configuration using node: " + ignite.name());
    CacheConfiguration cfg = new CacheConfiguration(DEFAULT_CACHE_NAME);
    cfg.setName("org.apache.ignite" + iter + "*");
    cfg.setBackups(iter);
    for (int i = 0; i < 100; i++)
      ignite.addCacheConfiguration(cfg);
    return null;
  }
}, 15, "add-configuration");

代码示例来源:origin: apache/ignite

/**
 * Start SQL cache on given node.
 * @param node Node to create cache on.
 * @return Created cache.
 */
private IgniteCache<?, ?> createSqlCache(Ignite node) throws IgniteCheckedException {
  node.addCacheConfiguration(new CacheConfiguration<>("TPL")
    .setCacheMode(cacheMode)
    .setAtomicityMode(atomicityMode)
    .setNodeFilter(new NodeFilter()));
  return node.getOrCreateCache(new CacheConfiguration<>("idx").setIndexedTypes(Integer.class, Integer.class));
}

代码示例来源:origin: apache/ignite

ignite.addCacheConfiguration(ccfg);

代码示例来源:origin: apache/ignite

/**
 * @throws Exception If failed.
 */
@Test
public void testDefaultTemplate() throws Exception {
  Ignite ignite = startGrid(0);
  checkDefaultTemplate(ignite, "org.apache.ignite");
  checkDefaultTemplate(ignite, "org.apache.ignite.templat");
  checkDefaultTemplate(ignite, DEFAULT_CACHE_NAME);
  checkGetOrCreate(ignite, "org.apache.ignite.template", 3);
  CacheConfiguration templateCfg = new CacheConfiguration("*");
  templateCfg.setBackups(4);
  ignite.addCacheConfiguration(templateCfg);
  checkGetOrCreate(ignite, "org.apache.ignite2", 4);
}

代码示例来源:origin: apache/ignite

/**
 * @throws Exception If failed.
 */
@Test
public void testTemplateCleanup() throws Exception {
  startGridsMultiThreaded(3);
  try {
    CacheConfiguration ccfg = new CacheConfiguration("affTemplate-*");
    ccfg.setAffinity(new RendezvousAffinityFunction());
    ignite(0).addCacheConfiguration(ccfg);
    ignite(0).getOrCreateCache("affTemplate-1");
    IgniteCache<Object, Object> cache = ignite(0).getOrCreateCache("affTemplate-2");
    ignite(0).destroyCache("affTemplate-1");
    startGrid(3);
    cache.put(1, 1);
    assertEquals(1, cache.get(1));
  }
  finally {
    stopAllGrids();
  }
}

代码示例来源:origin: apache/ignite

template1.setBackups(5);
ignite2.addCacheConfiguration(template1);
template2.setBackups(6);
ignite0.addCacheConfiguration(template2);

代码示例来源:origin: apache/ignite

template1.setBackups(5);
ignite2.addCacheConfiguration(template1);

代码示例来源:origin: org.apache.ignite/ignite-spring

/** {@inheritDoc} */
@Override public <K, V> void addCacheConfiguration(CacheConfiguration<K, V> cacheCfg) {
  checkIgnite();
  g.addCacheConfiguration(cacheCfg);
}

相关文章