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

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

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

Pipeline.hget介绍

暂无

代码示例

代码示例来源:origin: signalapp/Signal-Server

public PendingClientContact get(BatchOperationHandle handle, byte[] token) {
 Pipeline pipeline = handle.pipeline;
 return new PendingClientContact(objectMapper, token, pipeline.hget(DIRECTORY_KEY, token));
}

代码示例来源:origin: signalapp/Signal-Server

public List<ClientContact> get(List<byte[]> tokens) {
 try (Jedis jedis = redisPool.getWriteResource()) {
  Pipeline               pipeline = jedis.pipelined();
  List<Response<byte[]>> futures  = new LinkedList<>();
  List<ClientContact>    results  = new LinkedList<>();
  try {
   for (byte[] token : tokens) {
    futures.add(pipeline.hget(DIRECTORY_KEY, token));
   }
  } finally {
   pipeline.sync();
  }
  IterablePair<byte[], Response<byte[]>> lists = new IterablePair<>(tokens, futures);
  for (Pair<byte[], Response<byte[]>> pair : lists) {
   try {
    if (pair.second().get() != null) {
     TokenValue    tokenValue    = objectMapper.readValue(pair.second().get(), TokenValue.class);
     ClientContact clientContact = new ClientContact(pair.first(), tokenValue.relay, tokenValue.voice, tokenValue.video);
     results.add(clientContact);
    }
   } catch (IOException e) {
    logger.warn("Deserialization Problem: ", e);
   }
  }
  return results;
 }
}

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

@Override
public byte[] hGet(byte[] key, byte[] field) {
  Assert.notNull(key, "Key must not be null!");
  Assert.notNull(field, "Field must not be null!");
  try {
    if (isPipelined()) {
      pipeline(connection.newJedisResult(connection.getRequiredPipeline().hget(key, field)));
      return null;
    }
    if (isQueueing()) {
      transaction(connection.newJedisResult(connection.getRequiredTransaction().hget(key, field)));
      return null;
    }
    return connection.getJedis().hget(key, field);
  } catch (Exception ex) {
    throw convertJedisAccessException(ex);
  }
}

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

@Override
  Response<String> execute(Pipeline jedisPipeline) throws DynoException {
    return jedisPipeline.hget(key, field);
  }
}.execute(key, OpName.HGET);

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

@Override
  Response<byte[]> execute(Pipeline jedisPipeline) throws DynoException {
    return jedisPipeline.hget(key, field);
  }
}.execute(key, OpName.HGET);

代码示例来源:origin: Netflix/dyno-queues

@Override
public Response<String> hget(String key, String member) {
  return pipe.hget(key, member);
}

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

@Override
public Response<byte[]> hget(byte[] key, byte[] field) {
 String command = "hget";
 return instrumented(command, () -> delegated.hget(key, field));
}

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

@Override
public Response<String> hget(String key, String field) {
 String command = "hget";
 return instrumented(command, () -> delegated.hget(key, field));
}

代码示例来源:origin: com.netflix.spinnaker.orca/orca-redis

protected List<ExecutionStatus> fetchMultiExecutionStatus(RedisClientDelegate redisClientDelegate, List<String> keys) {
 return redisClientDelegate.withMultiKeyPipeline(p -> {
  List<Response<String>> responses = keys.stream()
   .map(k -> p.hget(k, "status"))
   .collect(Collectors.toList());
  p.sync();
  return responses.stream()
   .map(Response::get)
   .filter(Objects::nonNull) // apparently we have some null statuses even though that makes no sense
   .map(ExecutionStatus::valueOf)
   .collect(Collectors.toList());
 });
}

代码示例来源:origin: com.github.biezhi/unique-support-redis

@Override
  String execute() {
    Pipeline pipeline = jedis.getShard(key).pipelined();
    Response<String> result = pipeline.hget(key, field);
    pipeline.expire(key, expire);
    pipeline.sync();
    return result.get();
  }
}.getResult();

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

@Override
public byte[] hGet(byte[] key, byte[] field) {
  Assert.notNull(key, "Key must not be null!");
  Assert.notNull(field, "Field must not be null!");
  try {
    if (isPipelined()) {
      pipeline(connection.newJedisResult(connection.getRequiredPipeline().hget(key, field)));
      return null;
    }
    if (isQueueing()) {
      transaction(connection.newJedisResult(connection.getRequiredTransaction().hget(key, field)));
      return null;
    }
    return connection.getJedis().hget(key, field);
  } catch (Exception ex) {
    throw convertJedisAccessException(ex);
  }
}

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

@Override
public byte[] hGet(byte[] key, byte[] field) {
  Assert.notNull(key, "Key must not be null!");
  Assert.notNull(field, "Field must not be null!");
  try {
    if (isPipelined()) {
      pipeline(connection.newJedisResult(connection.getRequiredPipeline().hget(key, field)));
      return null;
    }
    if (isQueueing()) {
      transaction(connection.newJedisResult(connection.getRequiredTransaction().hget(key, field)));
      return null;
    }
    return connection.getJedis().hget(key, field);
  } catch (Exception ex) {
    throw convertJedisAccessException(ex);
  }
}

相关文章

Pipeline类方法