本文整理汇总了Java中org.apache.ignite.IgniteCache.remove方法的典型用法代码示例。如果您正苦于以下问题:Java IgniteCache.remove方法的具体用法?Java IgniteCache.remove怎么用?Java IgniteCache.remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.ignite.IgniteCache
的用法示例。
在下文中一共展示了IgniteCache.remove方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getReference
import org.apache.ignite.IgniteCache; //导入方法依赖的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);
}
}
};
}
示例2: singleCommit
import org.apache.ignite.IgniteCache; //导入方法依赖的package包/类
protected void singleCommit(TransactionSupplier txSupplier, IgniteInClosure<Long> onSingleCommit, long txId) {
TransactionDataIterator it = txSupplier.dataIterator(txId);
try (Transaction tx = ignite.transactions().txStart()) {
while (it.hasNextCache()) {
IgniteCache<Object, Object> cache = ignite.cache(it.nextCache());
while (it.hasNextEntry()) {
it.advance();
Object value = it.getValue();
if (ActiveCacheStore.TOMBSTONE.equals(value)) {
cache.remove(it.getKey());
} else {
cache.put(it.getKey(), value);
}
}
}
tx.commit();
}
onSingleCommit.apply(txId);
}
示例3: testManualHBaseInsertion
import org.apache.ignite.IgniteCache; //导入方法依赖的package包/类
@Test
public void testManualHBaseInsertion() throws ServiceException, IOException {
IgniteConfiguration cfg = prepareConfig(false);
IgniteConfiguration cfg2 = new IgniteConfiguration(cfg);
cfg.setGridName("first");
cfg2.setGridName("second");
String cacheName = "myCache";
try (Ignite ignite = Ignition.getOrStart(cfg); Ignite ignite2 = Ignition.getOrStart(cfg2)) {
IgniteCache<String, String> cache = ignite.getOrCreateCache(cacheName);
cache.remove("Hello");
assertNull(cache.get("Hello"));
try (Connection conn = getHBaseConnection()) {
TableName tableName = TableName.valueOf(TABLE_NAME);
Table table = conn.getTable(tableName);
Serializer<Object> serializer = ObjectSerializer.INSTANCE;
Put put = new Put(serializer.serialize("Hello"));
put.addColumn(cacheName.getBytes(), QUALIFIER, serializer.serialize("World"));
table.put(put);
}
assertEquals("World", cache.get("Hello"));
}
}
示例4: testDelete
import org.apache.ignite.IgniteCache; //导入方法依赖的package包/类
@Test
public void testDelete() {
IgniteConfiguration cfg = prepareConfig();
IgniteConfiguration cfg2 = new IgniteConfiguration(cfg);
cfg.setGridName("first");
cfg2.setGridName("second");
try (Ignite ignite = Ignition.getOrStart(cfg); Ignite ignite2 = Ignition.getOrStart(cfg2)) {
IgniteCache<String, String> cache = ignite.getOrCreateCache("myCache");
cache.put("Hello", "World");
cache.put("Hello", "World");
assertEquals("World", cache.get("Hello"));
cache.remove("Hello");
assertNull(cache.get("Hello"));
}
}
示例5: deleteAlertEntry
import org.apache.ignite.IgniteCache; //导入方法依赖的package包/类
@Override
public void deleteAlertEntry(String alertId) {
final IgniteCache<String, AlertEntry> alertsCache = getAlertsCache();
alertsCache.remove(alertId);
}
示例6: removeTuple
import org.apache.ignite.IgniteCache; //导入方法依赖的package包/类
@Override
public void removeTuple(EntityKey key, TupleContext tupleContext) {
IgniteCache<Object, BinaryObject> entityCache = provider.getEntityCache( key.getMetadata() );
entityCache.remove( provider.createKeyObject( key ) );
}