public PendingClientContact get(BatchOperationHandle handle, byte[] token) { Pipeline pipeline = handle.pipeline; return new PendingClientContact(objectMapper, token, pipeline.hget(DIRECTORY_KEY, token)); }
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; } }
@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); } }
@Override Response<String> execute(Pipeline jedisPipeline) throws DynoException { return jedisPipeline.hget(key, field); } }.execute(key, OpName.HGET);
@Override Response<byte[]> execute(Pipeline jedisPipeline) throws DynoException { return jedisPipeline.hget(key, field); } }.execute(key, OpName.HGET);
@Override public Response<String> hget(String key, String member) { return pipe.hget(key, member); }
@Override public Response<byte[]> hget(byte[] key, byte[] field) { String command = "hget"; return instrumented(command, () -> delegated.hget(key, field)); }
@Override public Response<String> hget(String key, String field) { String command = "hget"; return instrumented(command, () -> delegated.hget(key, field)); }
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()); }); }
@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();
@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); } }
@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); } }