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

x33g5p2x  于2022-01-26 转载在 其他  
字(4.2k)|赞(0)|评价(0)|浏览(229)

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

Pipeline.zrangeWithScores介绍

暂无

代码示例

代码示例来源:origin: spring-projects/spring-data-redis

@Override
public Set<Tuple> zRangeWithScores(byte[] key, long start, long end) {
  Assert.notNull(key, "Key must not be null!");
  try {
    if (isPipelined()) {
      pipeline(connection.newJedisResult(connection.getRequiredPipeline().zrangeWithScores(key, start, end),
          JedisConverters.tupleSetToTupleSet()));
      return null;
    }
    if (isQueueing()) {
      transaction(connection.newJedisResult(connection.getRequiredTransaction().zrangeWithScores(key, start, end),
          JedisConverters.tupleSetToTupleSet()));
      return null;
    }
    return JedisConverters.toTupleSet(connection.getJedis().zrangeWithScores(key, start, end));
  } catch (Exception ex) {
    throw convertJedisAccessException(ex);
  }
}

代码示例来源:origin: com.netflix.dyno/dyno-jedis

@Override
Response<Set<Tuple>> execute(Pipeline jedisPipeline) throws DynoException {
  return jedisPipeline.zrangeWithScores(key, start, end);
}

代码示例来源:origin: com.netflix.spinnaker.kork/kork-jedis

@Override
public Response<Set<Tuple>> zrangeWithScores(String key, long start, long end) {
 String command = "zrangeWithScores";
 return instrumented(command, () -> delegated.zrangeWithScores(key, start, end));
}

代码示例来源:origin: com.netflix.spinnaker.kork/kork-jedis

@Override
public Response<Set<Tuple>> zrangeWithScores(byte[] key, long start, long end) {
 String command = "zrangeWithScores";
 return instrumented(command, () -> delegated.zrangeWithScores(key, start, end));
}

代码示例来源:origin: pyloque/captain

public ServiceSet serviceSet(String name) {
  Holder<Response<Long>> version = new Holder<Response<Long>>();
  Holder<Response<Set<Tuple>>> services = new Holder<Response<Set<Tuple>>>();
  Holder<Response<Map<String, String>>> payloadsHolder = new Holder<Response<Map<String, String>>>();
  this.redis.pipeline(pipe -> {
    version.set(pipe.incrBy(keyForVersion(name), 0));
    services.set(pipe.zrangeWithScores(keyForSet(name), 0, -1));
    payloadsHolder.set(pipe.hgetAll(keyForPayload(name)));
  });
  Set<ServiceItem> items = new HashSet<ServiceItem>();
  long now = System.currentTimeMillis() / 1000;
  Map<String, String> payloads = payloadsHolder.value().get();
  for (Tuple tuple : services.value().get()) {
    String[] pair = tuple.getElement().split(":");
    String host = pair[0];
    int port = Integer.parseInt(pair[1]);
    int ttl = (int) (tuple.getScore() - now);
    String payload = payloads.get(tuple.getElement());
    items.add(new ServiceItem(name, host, port, ttl, payload));
  }
  ServiceSet set = new ServiceSet(name, items, version.value().get());
  if (set.isEmpty()) {
    this.redis.execute(jedis -> {
      jedis.srem(nameKeys, name);
    });
  }
  return set;
}

代码示例来源:origin: apache/servicemix-bundles

@Override
public Set<Tuple> zRangeWithScores(byte[] key, long start, long end) {
  Assert.notNull(key, "Key must not be null!");
  try {
    if (isPipelined()) {
      pipeline(connection.newJedisResult(connection.getRequiredPipeline().zrangeWithScores(key, start, end),
          JedisConverters.tupleSetToTupleSet()));
      return null;
    }
    if (isQueueing()) {
      transaction(connection.newJedisResult(connection.getRequiredTransaction().zrangeWithScores(key, start, end),
          JedisConverters.tupleSetToTupleSet()));
      return null;
    }
    return JedisConverters.toTupleSet(connection.getJedis().zrangeWithScores(key, start, end));
  } catch (Exception ex) {
    throw convertJedisAccessException(ex);
  }
}

代码示例来源:origin: org.springframework.data/spring-data-redis

@Override
public Set<Tuple> zRangeWithScores(byte[] key, long start, long end) {
  Assert.notNull(key, "Key must not be null!");
  try {
    if (isPipelined()) {
      pipeline(connection.newJedisResult(connection.getRequiredPipeline().zrangeWithScores(key, start, end),
          JedisConverters.tupleSetToTupleSet()));
      return null;
    }
    if (isQueueing()) {
      transaction(connection.newJedisResult(connection.getRequiredTransaction().zrangeWithScores(key, start, end),
          JedisConverters.tupleSetToTupleSet()));
      return null;
    }
    return JedisConverters.toTupleSet(connection.getJedis().zrangeWithScores(key, start, end));
  } catch (Exception ex) {
    throw convertJedisAccessException(ex);
  }
}

相关文章

Pipeline类方法