是否可以删除 IgniteRDD 共享缓存中的单个值?
Is it possible to delete a single value in the shared cache of an IgniteRDD?
是否可以从 Ignite 共享缓存 (IgniteRDD) 中删除特定项目?
例如,在下面的代码中,如何删除唯一的项目 (21, 21)?
val cacheRdd = igniteContext.fromCache("partitioned")
cacheRdd.savePairs(sparkContext.parallelize(1 to 10000, 10).map(i => (i, i)))
IgniteRDD 提供了一个名为 clear()
的方法,可以从缓存中删除所有内容。有没有类似于删除特定项目的东西?
我知道几种方法:
1)使用SQL删除命令
val cacheRdd = igniteContext.fromCache("Person")
val result = cacheRdd.sql(
"DELETE FROM PERSON WHERE ID=1")
2) 使用 JCache API:
// Creates Ignite context with specific configuration and runs Ignite in the embedded mode.
JavaIgniteContext<Integer, Integer> igniteContext = new JavaIgniteContext<Integer, Integer>(
sparkContext,"examples/config/spark/example-shared-rdd.xml", false);
IgniteCache<Long, Person> personIgniteCache = igniteContext.ignite().getOrCreateCache("Person");
personIgniteCache.remove(1L);
与 scala 相同:
val igniteContext = new IgniteContext(sparkContext, CONFIG, false)
igniteContext.ignite().getOrCreateCache("Person");
您也可以只在驱动程序应用程序中启动 Ignite 节点。
BR,
安德烈
是否可以从 Ignite 共享缓存 (IgniteRDD) 中删除特定项目?
例如,在下面的代码中,如何删除唯一的项目 (21, 21)?
val cacheRdd = igniteContext.fromCache("partitioned")
cacheRdd.savePairs(sparkContext.parallelize(1 to 10000, 10).map(i => (i, i)))
IgniteRDD 提供了一个名为 clear()
的方法,可以从缓存中删除所有内容。有没有类似于删除特定项目的东西?
我知道几种方法:
1)使用SQL删除命令
val cacheRdd = igniteContext.fromCache("Person")
val result = cacheRdd.sql(
"DELETE FROM PERSON WHERE ID=1")
2) 使用 JCache API:
// Creates Ignite context with specific configuration and runs Ignite in the embedded mode.
JavaIgniteContext<Integer, Integer> igniteContext = new JavaIgniteContext<Integer, Integer>(
sparkContext,"examples/config/spark/example-shared-rdd.xml", false);
IgniteCache<Long, Person> personIgniteCache = igniteContext.ignite().getOrCreateCache("Person");
personIgniteCache.remove(1L);
与 scala 相同:
val igniteContext = new IgniteContext(sparkContext, CONFIG, false)
igniteContext.ignite().getOrCreateCache("Person");
您也可以只在驱动程序应用程序中启动 Ignite 节点。
BR, 安德烈