本文整理了Java中org.apache.geode.cache.Region.remove
方法的一些代码示例,展示了Region.remove
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Region.remove
方法的具体详情如下:
包路径:org.apache.geode.cache.Region
类名称:Region
方法名:remove
[英]Removes the entry with the specified key. The operation removes not only the value but also the key and entry from this region. Remove will be distributed to other caches if the scope is not Scope.LOCAL
.
Does not update any CacheStatistics
.
[中]删除具有指定密钥的条目。该操作不仅会删除该区域中的值,还会删除该区域中的键和条目。如果作用域不是[$0$],则删除将分发到其他缓存。
不更新任何CacheStatistics
。
代码示例来源:origin: apache/geode
@Override
public Object remove(Object key) {
return map.remove(key);
}
代码示例来源:origin: apache/geode
private void testAllOperations() {
ClientCache clientCache = (ClientCache) cache;
Region<String, String> region =
clientCache.<String, String>createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY)
.create("internalRegion");
assertFailure(() -> region.create("Object1", "Value1"));
assertFailure(() -> region.put("Object1", "Value1"));
assertFailure(() -> region.putIfAbsent("Object1", "Value1"));
assertFailure(() -> region.get("Object1"));
Map<String, String> map = new HashMap<>();
map.put("Object1", "Value1");
assertFailure(() -> region.putAll(map));
List<String> list = new ArrayList<>();
list.add("Object1");
assertFailure(() -> region.getAll(list));
assertFailure(() -> region.removeAll(list));
assertFailure(() -> region.destroy("Object1"));
assertFailure(() -> region.remove("Object1"));
assertFailure(() -> region.replace("Object1", "oldValue", "newValue"));
assertFailure(() -> region.invalidate("Object1"));
assertFailure(region::keySetOnServer);
assertFailure(() -> region.registerInterest("Object1"));
}
代码示例来源:origin: apache/geode
private boolean metaRemoveEntry(ByteArrayWrapper key) {
return this.redisMetaRegion.remove(key.toString()) != null;
}
代码示例来源:origin: apache/geode
@Override
public boolean remove(Object key, Object value) {
try {
preOp();
return this.realRegion.remove(key, value);
} finally {
postOp();
}
}
代码示例来源:origin: apache/geode
public void unMarkForFederation(ObjectName objName) {
synchronized (lock) {
if (federatedComponentMap.get(objName) != null) {
federatedComponentMap.remove(objName);
}
if (repo.getLocalMonitoringRegion() != null
&& repo.getLocalMonitoringRegion().get(objName.toString()) != null) {
// To delete an entry from the region
repo.getLocalMonitoringRegion().remove(objName.toString());
}
}
}
代码示例来源:origin: apache/geode
@Override
public Object remove(Object key) {
try {
preOp();
return this.realRegion.remove(key);
} finally {
postOp();
}
}
代码示例来源:origin: apache/geode
@Override
public <K, V> V remove(String regionName, K key) {
security.authorize(DATA, WRITE, regionName, key);
Region<K, V> region = getRegion(regionName);
Object oldValue = region.remove(key);
return (V) security.postProcess(regionName, key, oldValue);
}
代码示例来源:origin: apache/geode
try {
if (type == RedisDataType.REDIS_STRING) {
return this.stringsRegion.remove(key) != null;
} else if (type == RedisDataType.REDIS_HLL) {
return this.hLLRegion.remove(key) != null;
} else {
return destroyRegion(key, type);
代码示例来源:origin: apache/geode
@Override
public void run() {
getMemcachedRegion(cache).remove(key);
expiryFutures.remove(key);
if (cache.getLogger().fineEnabled()) {
cache.getLogger().fine("expiration removed key:" + key);
}
}
}
代码示例来源:origin: apache/geode
@Before
public void setUp() throws Exception {
regionStub = mock(Region.class);
when(regionStub.remove(TEST_KEY)).thenReturn(TEST_VALUE);
when(regionStub.containsKey(TEST_KEY)).thenReturn(true);
when(regionStub.containsKey(MISSING_KEY)).thenReturn(false);
when(cacheStub.getRegion(TEST_REGION)).thenReturn(regionStub);
when(cacheStub.getRegion(MISSING_REGION)).thenReturn(null);
operationHandler = new RemoveRequestOperationHandler();
}
代码示例来源:origin: apache/geode
@Test
public void removeIsPostProcessed() {
authorize(DATA, WRITE, REGION, "a");
when(region.remove("a")).thenReturn("value");
when(security.postProcess(REGION, "a", "value")).thenReturn("spam");
Object value = authorizingCache.remove(REGION, "a");
verify(region).remove("a");
assertEquals("spam", value);
}
代码示例来源:origin: apache/geode
@Test
public void remove() {
authorize(DATA, WRITE, REGION, "a");
authorizingCache.remove(REGION, "a");
verify(region).remove("a");
}
代码示例来源:origin: apache/geode
@Override
public void executeCommand(Command command, ExecutionHandlerContext context) {
List<byte[]> commandElems = command.getProcessedCommand();
if (commandElems.size() < 2) {
command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.SPOP));
return;
}
ByteArrayWrapper key = command.getKey();
@SuppressWarnings("unchecked")
Region<ByteArrayWrapper, Boolean> keyRegion =
(Region<ByteArrayWrapper, Boolean>) context.getRegionProvider().getRegion(key);
if (keyRegion == null || keyRegion.isEmpty()) {
command.setResponse(Coder.getNilResponse(context.getByteBufAllocator()));
return;
}
Random rand = new Random();
ByteArrayWrapper[] entries = keyRegion.keySet().toArray(new ByteArrayWrapper[keyRegion.size()]);
ByteArrayWrapper pop = entries[rand.nextInt(entries.length)];
keyRegion.remove(pop);
if (keyRegion.isEmpty()) {
context.getRegionProvider().removeKey(key);
}
respondBulkStrings(command, context, pop);
}
代码示例来源:origin: apache/geode
@Test
public void processValidKeyRemovesTheEntryAndReturnSuccess() throws Exception {
RegionAPI.RemoveRequest removeRequest = generateTestRequest(false, false).getRemoveRequest();
Result result = operationHandler.process(serializationService, removeRequest,
TestExecutionContext.getNoAuthCacheExecutionContext(cacheStub));
assertTrue(result instanceof Success);
verify(regionStub).remove(TEST_KEY);
}
代码示例来源:origin: apache/geode
oldVal = keyRegion.remove(new ByteArrayWrapper(commandElems.get(i)));
if (oldVal != null)
numRemoved++;
代码示例来源:origin: apache/geode
Object oldVal = keyRegion.remove(entry);
if (oldVal != null)
numRemoved++;
代码示例来源:origin: apache/geode
byte[] memberArray = commandElems.get(i);
ByteArrayWrapper member = new ByteArrayWrapper(memberArray);
Object oldVal = keyRegion.remove(member);
if (oldVal != null)
numDeletedMembers++;
代码示例来源:origin: apache/geode
@Override
public void executeCommand(Command command, ExecutionHandlerContext context) {
List<byte[]> commandElems = command.getProcessedCommand();
if (commandElems.size() < 3) {
command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.HDEL));
return;
}
int numDeleted = 0;
ByteArrayWrapper key = command.getKey();
checkDataType(key, RedisDataType.REDIS_HASH, context);
Region<ByteArrayWrapper, ByteArrayWrapper> keyRegion = getRegion(context, key);
if (keyRegion == null) {
command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), numDeleted));
return;
}
for (int i = START_FIELDS_INDEX; i < commandElems.size(); i++) {
ByteArrayWrapper field = new ByteArrayWrapper(commandElems.get(i));
Object oldValue = keyRegion.remove(field);
if (oldValue != null)
numDeleted++;
}
if (keyRegion.isEmpty()) {
context.getRegionProvider().removeKey(key, RedisDataType.REDIS_HASH);
}
command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), numDeleted));
}
代码示例来源:origin: apache/geode
Object oldVal = keyRegion.remove(removeKey);
if (oldVal != null)
numRemoved++;
代码示例来源:origin: apache/geode
sourceRegion.remove(mem);
内容来源于网络,如有侵权,请联系作者删除!