redis.clients.jedis.JedisCommands.hscan()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(3.0k)|赞(0)|评价(0)|浏览(86)

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

JedisCommands.hscan介绍

暂无

代码示例

代码示例来源:origin: Netflix/conductor

public Map<String, String> hgetAll(String key) {
  Map<String, String> m = new HashMap<>();
  JedisCommands dyno = dynoClient;
  int cursor = 0;
  do {
    ScanResult<Entry<String, String>> sr = dyno.hscan(key, "" + cursor);
    cursor = Integer.parseInt(sr.getStringCursor());
    for (Entry<String, String> r : sr.getResult()) {
      m.put(r.getKey(), r.getValue());
    }
  } while (cursor > 0);
  return m;
}

代码示例来源:origin: Netflix/conductor

public Set<String> hkeys(String key) {
  logger.trace("hkeys {}", key);
  JedisCommands client = dynoClient;
  Set<String> keys = new HashSet<>();
  int cursor = 0;
  do {
    ScanResult<Entry<String, String>> sr = client.hscan(key, "" + cursor);
    cursor = Integer.parseInt(sr.getStringCursor());
    List<Entry<String, String>> result = sr.getResult();
    for (Entry<String, String> e : result) {
      keys.add(e.getKey());
    }
  } while (cursor > 0);
  return keys;
}

代码示例来源:origin: Netflix/conductor

public Map<String, String> hscan(String key, int count) {
  Map<String, String> m = new HashMap<>();
  int cursor = 0;
  do {
    ScanResult<Entry<String, String>> sr = dynoClient.hscan(key, "" + cursor);
    cursor = Integer.parseInt(sr.getStringCursor());
    for (Entry<String, String> r : sr.getResult()) {
      m.put(r.getKey(), r.getValue());
    }
    if (m.size() > count) {
      break;
    }
  } while (cursor > 0);
  return m;
}

代码示例来源:origin: com.netflix.conductor/conductor-redis-persistence

public Map<String, String> hgetAll(String key) {
  Map<String, String> m = new HashMap<>();
  JedisCommands dyno = dynoClient;
  int cursor = 0;
  do {
    ScanResult<Entry<String, String>> sr = dyno.hscan(key, "" + cursor);
    cursor = Integer.parseInt(sr.getStringCursor());
    for (Entry<String, String> r : sr.getResult()) {
      m.put(r.getKey(), r.getValue());
    }
  } while (cursor > 0);
  return m;
}

代码示例来源:origin: com.netflix.conductor/conductor-redis-persistence

public Map<String, String> hscan(String key, int count) {
  Map<String, String> m = new HashMap<>();
  int cursor = 0;
  do {
    ScanResult<Entry<String, String>> sr = dynoClient.hscan(key, "" + cursor);
    cursor = Integer.parseInt(sr.getStringCursor());
    for (Entry<String, String> r : sr.getResult()) {
      m.put(r.getKey(), r.getValue());
    }
    if (m.size() > count) {
      break;
    }
  } while (cursor > 0);
  return m;
}

代码示例来源:origin: com.netflix.conductor/conductor-redis-persistence

public Set<String> hkeys(String key) {
  logger.trace("hkeys {}", key);
  JedisCommands client = dynoClient;
  Set<String> keys = new HashSet<>();
  int cursor = 0;
  do {
    ScanResult<Entry<String, String>> sr = client.hscan(key, "" + cursor);
    cursor = Integer.parseInt(sr.getStringCursor());
    List<Entry<String, String>> result = sr.getResult();
    for (Entry<String, String> e : result) {
      keys.add(e.getKey());
    }
  } while (cursor > 0);
  return keys;
}

相关文章

微信公众号

最新文章

更多