com.hazelcast.core.IMap.clear()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(4.7k)|赞(0)|评价(0)|浏览(173)

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

IMap.clear介绍

[英]Clears the map and deletes the items from the backing map store.

The MAP_CLEARED event is fired for any registered listeners. See com.hazelcast.core.EntryListener#mapCleared(MapEvent).

To clear the map without removing the items from the map store, use #evictAll.

Interactions with the map store

Calls MapStore#deleteAll(Collection) on each partition with the keys that the given partition stores. Exceptions thrown by deleteAll() are not propagated to the caller.
[中]清除地图并从备份地图存储中删除项目。
将为任何已注册的侦听器触发MAP_CLEARED事件。见com。黑泽尔卡斯特。果心EntryListener#mapCleared(MapEvent)。
要清除地图而不从地图存储中删除项目,请使用#executeall。
与地图商店的交互
使用给定分区存储的键在每个分区上调用MapStore#deleteAll(Collection)。deleteAll()引发的异常不会传播到调用方。

代码示例

代码示例来源:origin: org.apache.camel/camel-hazelcast

/**
 * Clear all the entries
 */
private void clear(Exchange exchange) {
  this.cache.clear();
}

代码示例来源:origin: com.intrbiz.util/cache-hazelcast

public void clear()
{
  // cannot be transactional :(
  this.cache.clear();
}

代码示例来源:origin: hazelcast/hazelcast-jet

@Override
public void deleteAll(String mapName) {
  final IMap<Object, Object> map = hazelcast.getMap(mapName);
  map.clear();
}

代码示例来源:origin: com.hazelcast/hazelcast-all

@Override
public void deleteAll(String mapName) {
  final IMap<Object, Object> map = hazelcast.getMap(mapName);
  map.clear();
}

代码示例来源:origin: org.wicketstuff/wicketstuff-datastore-hazelcast

@Override
public void removeData(String sessionId)
{
  IMap<Integer, byte[]> map = hazelcast.getMap(sessionId);
  map.clear();
  LOGGER.debug("Deleted data for session '{}'", sessionId);
}

代码示例来源:origin: hazelcast/hazelcast-code-samples

@Override
public void clear() {
  Stream.of(MAP_NAME, GPS)
      .forEach(it -> client.getMap(it).clear());
}

代码示例来源:origin: hazelcast/hazelcast-code-samples

@RequestMapping("/clear")
  public CommandResponse clear() {
    IMap<String, String> map = hazelcastInstance.getMap("map");
    map.clear();
    return new CommandResponse("Map cleared");
  }
}

代码示例来源:origin: org.geoserver.community/gs-hz-cluster

@Override
public void invalidateAll() {
  if (available()) {
    hzMap.clear();
  }
}

代码示例来源:origin: hazelcast/hazelcast-code-samples

@RequestMapping("/clear")
  public CommandResponse clear() {
    IMap<String, String> map = hazelcastInstance.getMap("map");
    map.clear();
    return new CommandResponse("Map cleared");
  }
}

代码示例来源:origin: hazelcast/hazelcast-code-samples

@RequestMapping("/clear")
  public CommandResponse clear() {
    IMap<String, String> map = hazelcastClient.getMap("map");
    map.clear();
    return new CommandResponse("Map cleared");
  }
}

代码示例来源:origin: hazelcast/hazelcast-code-samples

@RequestMapping("/clear")
  public CommandResponse clear() {
    IMap<String, String> map = hazelcastClient.getMap("map");
    map.clear();
    return new CommandResponse("Map cleared");
  }
}

代码示例来源:origin: hazelcast/hazelcast-code-samples

@RequestMapping("/clear")
  public CommandResponse clear() {
    IMap<String, String> map = hazelcastInstance.getMap("map");
    map.clear();
    return new CommandResponse("Map cleared");
  }
}

代码示例来源:origin: com.erudika/para

@Override
public void removeAll(String appid) {
  if (!StringUtils.isBlank(appid)) {
    logger.debug("Cache.removeAll() {}", appid);
    client().getMap(appid).clear();
  }
}

代码示例来源:origin: com.atlassian.cache/atlassian-cache-hazelcast

private void cleanupMap()
{
 cacheVersion.incrementAndGet();
 map.clear();
}

代码示例来源:origin: io.snamp/internal-services

/**
 * Removes all record.
 */
@Override
public void clear() {
  getDistributedObject().clear();
}

代码示例来源:origin: mokies/ratelimitj

@Override
public boolean resetLimit(String key) {
  IMap<Object, Object> map = hz.getMap(key);
  if (map == null || map.isEmpty()) {
    return false;
  }
  map.clear();
  map.destroy();
  return true;
}

代码示例来源:origin: hazelcast/hazelcast-jet

@ManagedAnnotation(value = "clear", operation = true)
@ManagedDescription("Clear Map")
public void clear() {
  managedObject.clear();
}

代码示例来源:origin: com.hazelcast/hazelcast-all

@ManagedAnnotation(value = "clear", operation = true)
@ManagedDescription("Clear Map")
public void clear() {
  managedObject.clear();
}

代码示例来源:origin: hazelcast/hazelcast-jet

void clearSnapshotData(long jobId, int dataMapIndex) {
  String mapName = snapshotDataMapName(jobId, dataMapIndex);
  try {
    instance.getMap(mapName).clear();
    logFine(logger, "Cleared snapshot data map %s", mapName);
  } catch (Exception logged) {
    logger.warning("Cannot delete old snapshot data  " + idToString(jobId), logged);
  }
}

代码示例来源:origin: com.sitewhere/sitewhere-core

@Override
public void clear() throws SiteWhereException {
if (getParent().getLifecycleStatus() == LifecycleStatus.Started) {
  hMap.clear();
} else {
  throw new SiteWhereException("Cache clear() called after shutdown.");
}
}

相关文章