本文整理了Java中org.apache.geode.cache.Region.put
方法的一些代码示例,展示了Region.put
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Region.put
方法的具体详情如下:
包路径:org.apache.geode.cache.Region
类名称:Region
方法名:put
[英]Places a new value into an entry in this region with the specified key. If there is already an entry associated with the specified key in this region, the entry's previous value is overwritten.
Updates the CacheStatistics#getLastAccessedTime and CacheStatistics#getLastModifiedTime for this region and the entry.
[中]使用指定的键将新值放入此区域的条目中。如果此区域中已有与指定键关联的条目,则该条目的上一个值将被覆盖。
更新此区域和条目的CacheStatistics#getLastAccessedTime和CacheStatistics#getLastModifiedTime。
代码示例来源:origin: apache/geode
/**
* will keep on putting till region overflows
*/
protected void putTillOverFlow(Region<Object, Object> region) {
for (int i = 0; i < 1010; i++) {
region.put(i + 200, i + 200);
}
}
代码示例来源:origin: apache/geode
public void populateRegion(String regionName, Map<?, ?> entries) {
Region r = cache.getRegion("/" + regionName);
entries.entrySet().forEach(e -> {
r.put(e.getKey(), e.getValue());
});
}
代码示例来源:origin: apache/geode
/**
* put an entry in local monitoring region
*
* @param name MBean name
* @param data The value part of the Map
*/
public void putEntryInLocalMonitoringRegion(String name, Object data) {
if (localMonitoringRegion != null && !localMonitoringRegion.isDestroyed()) {
localMonitoringRegion.put(name, data);
}
}
代码示例来源:origin: apache/geode
private void doInitializeList(ByteArrayWrapper key, Region r) {
r.put("head", 0);
r.put("tail", 0);
String fullpath = r.getFullPath();
HashMap<Enum<?>, Query> queryList = new HashMap<>();
for (ListQuery lq : ListQuery.values()) {
String queryString = lq.getQueryString(fullpath);
Query query = this.queryService.newQuery(queryString);
queryList.put(lq, query);
}
this.preparedQueries.put(key, queryList);
}
代码示例来源:origin: apache/geode
/**
* {@inheritDoc}
*/
@Override
public void putSession(HttpSession session) {
sessionCache.getOperatingRegion().put(session.getId(), session);
mbean.incRegionUpdates();
}
代码示例来源:origin: brianfrankcooper/YCSB
@Override
public Status update(String table, String key, Map<String, ByteIterator> values) {
getRegion(table).put(key, convertToBytearrayMap(values));
return Status.OK;
}
代码示例来源:origin: brianfrankcooper/YCSB
@Override
public Status insert(String table, String key, Map<String, ByteIterator> values) {
getRegion(table).put(key, convertToBytearrayMap(values));
return Status.OK;
}
代码示例来源:origin: apache/geode
public static void doHeavyPuts(String regionName, int numPuts) {
Region r = cache.getRegion(Region.SEPARATOR + regionName);
assertNotNull(r);
for (long i = 0; i < numPuts; i++) {
r.put(i, new byte[1024 * 1024]);
}
}
代码示例来源:origin: apache/geode
@Override
public <K, V> void put(String regionName, K key, V value) {
security.authorize(DATA, WRITE, regionName, key);
Region<K, V> region = getRegion(regionName);
region.put(key, value);
}
代码示例来源:origin: apache/geode
@Override
public Object call() throws RegionNotFoundException, CqExistsException, IndexExistsException,
IndexNameConflictException {
getCache().getRegion("/" + regionName).put(key, value);
return true;
}
});
代码示例来源:origin: apache/geode
@Override
public void run2() throws CacheException {
Region<Object, Object> region = getRootRegion().getSubregion(name);
region.put(key, newValue);
assertThat(writer().wasInvoked()).isTrue();
}
});
代码示例来源:origin: apache/geode
private static void prepareNotDeserializableDataForRegion(String regionPath) {
InternalCache cache = ClusterStartupRule.getCache();
Region dataRegion = cache.getRegion(regionPath);
for (int j = 0; j < 10; j++) {
dataRegion.put(new Integer(j), new shouldFailSerializationFilter(j));
}
}
代码示例来源:origin: apache/geode
@BeforeClass
public static void populateRegions() {
Cache cache = server.getCache();
Region<String, String> simpleRegion = cache.getRegion("simpleRegion");
Region<String, Customer> complexRegion = cache.getRegion("complexRegion");
for (int i = 0; i < Gfsh.DEFAULT_APP_FETCH_SIZE + 1; i++) {
String key = "key" + i;
simpleRegion.put(key, "value" + i);
complexRegion.put(key, new Customer("name" + i, "Main Street " + i, "Hometown"));
}
}
代码示例来源:origin: apache/geode
static void putForClient() {
Cache cache = new ClientServerMiscDUnitTestBase().getCache();
Region r2 = cache.getRegion(Region.SEPARATOR + REGION_NAME2);
if (r2 == null) {
r2 = cache.createRegionFactory(RegionShortcut.REPLICATE).create(REGION_NAME2);
}
r2.put(k1, "client2_k1");
r2.put(k2, "client2_k2");
}
代码示例来源:origin: apache/geode
@BeforeClass
public static void beforeClass() throws Exception {
InternalCache cache = server.getCache();
Region region = createPartitionedRegion(regionName, cache, String.class, Stock.class);
region.put("VMW", new Stock("VMW", 98));
region.put("APPL", new Stock("APPL", 600));
}
代码示例来源:origin: apache/geode
@Override
public void apply(Cache cache) {
Region<String, CachedDeserializable> region = getRegion(cache);
region.put(this.key,
CachedDeserializableFactory.create(this.gatewayDelta, (InternalCache) cache), true);
if (cache.getLogger().fineEnabled()) {
StringBuilder builder = new StringBuilder();
builder.append("Applied ").append(this);
cache.getLogger().fine(builder.toString());
}
}
代码示例来源:origin: apache/geode
@Override
public void run2() throws CacheException {
Region<Object, Object> region = getRootRegion().getSubregion(name);
region.put(key, newValue);
flushIfNecessary(region);
}
});
代码示例来源:origin: apache/geode
@Before
public void setUp() throws Exception {
regionMock = mock(Region.class);
when(regionMock.put(TEST_INVALID_KEY, TEST_INVALID_VALUE))
.thenThrow(new ClassCastException(EXCEPTION_TEXT));
when(cacheStub.getRegion(TEST_REGION)).thenReturn(regionMock);
operationHandler = new PutAllRequestOperationHandler();
}
代码示例来源:origin: apache/geode
protected void putIntoRegion(VM vm, Object[] keys, Object[] values, String regionName) {
vm.invoke(() -> {
Region region = getClientCache().getRegion(regionName);
assertEquals(
"Bad region put. The list of keys does not have the same length as the list of values.",
keys.length, values.length);
for (int i = 0; i < keys.length; i++) {
region.put(keys[i], values[i]);
}
});
}
代码示例来源:origin: apache/geode
@Test
public void processWithNoEntriesPasses() throws Exception {
Result result = operationHandler.process(serializationService,
generateTestRequest(false, false), getNoAuthCacheExecutionContext(cacheStub));
assertTrue(result instanceof Success);
verify(regionMock, times(0)).put(any(), any());
}
内容来源于网络,如有侵权,请联系作者删除!