@Override public Long bitPos(byte[] key, boolean bit, Range<Long> range) { Assert.notNull(key, "Key must not be null!"); Assert.notNull(range, "Range must not be null! Use Range.unbounded() instead."); List<byte[]> args = new ArrayList<>(3); args.add(LettuceConverters.toBit(bit)); if (range.getLowerBound().isBounded()) { args.add(range.getLowerBound().getValue().map(LettuceConverters::toBytes).get()); } if (range.getUpperBound().isBounded()) { args.add(range.getUpperBound().getValue().map(LettuceConverters::toBytes).get()); } return Long.class.cast(connection.execute("BITPOS", key, args)); }
@Nullable @Override public Long bitPos(byte[] key, boolean bit, Range<Long> range) { Assert.notNull(key, "Key must not be null!"); Assert.notNull(range, "Range must not be null! Use Range.unbounded() instead."); BitPosParams params = null; if (range.getLowerBound().isBounded()) { params = range.getUpperBound().isBounded() ? new BitPosParams(range.getLowerBound().getValue().get(), range.getUpperBound().getValue().get()) : new BitPosParams(range.getLowerBound().getValue().get()); } try { if (isPipelined()) { pipeline(connection.newJedisResult(params != null ? connection.getRequiredPipeline().bitpos(key, bit, params) : connection.getRequiredPipeline().bitpos(key, bit))); return null; } if (isQueueing()) { transaction( connection.newJedisResult(params != null ? connection.getRequiredTransaction().bitpos(key, bit, params) : connection.getRequiredTransaction().bitpos(key, bit))); return null; } return params != null ? connection.getJedis().bitpos(key, bit, params) : connection.getJedis().bitpos(key, bit); } catch (Exception ex) { throw convertJedisAccessException(ex); } }
@Override public Document toDocument() { Document doc = new Document(super.toDocument()); if (multipleOf != null) { doc.append("multipleOf", multipleOf); } if (range != null) { if (range.getLowerBound().isBounded()) { range.getLowerBound().getValue().ifPresent(it -> doc.append("minimum", it)); if (!range.getLowerBound().isInclusive()) { doc.append("exclusiveMinimum", true); } } if (range.getUpperBound().isBounded()) { range.getUpperBound().getValue().ifPresent(it -> doc.append("maximum", it)); if (!range.getUpperBound().isInclusive()) { doc.append("exclusiveMaximum", true); } } } return doc; }
RedisClusterAsyncCommands<byte[], byte[]> connection = getAsyncConnection(); if (range.getLowerBound().isBounded()) { if (range.getUpperBound().isBounded()) { futureResult = connection.bitpos(key, bit, getLowerValue(range), getUpperValue(range)); } else { if (range.getLowerBound().isBounded()) { if (range.getUpperBound().isBounded()) { return getConnection().bitpos(key, bit, getLowerValue(range), getUpperValue(range));
RedisClusterAsyncCommands<byte[], byte[]> connection = getAsyncConnection(); if (range.getLowerBound().isBounded()) { if (range.getUpperBound().isBounded()) { futureResult = connection.bitpos(key, bit, getLowerValue(range), getUpperValue(range)); } else { if (range.getLowerBound().isBounded()) { if (range.getUpperBound().isBounded()) { return getConnection().bitpos(key, bit, getLowerValue(range), getUpperValue(range));
@Nullable @Override public Long bitPos(byte[] key, boolean bit, Range<Long> range) { Assert.notNull(key, "Key must not be null!"); Assert.notNull(range, "Range must not be null! Use Range.unbounded() instead."); BitPosParams params = null; if (range.getLowerBound().isBounded()) { params = range.getUpperBound().isBounded() ? new BitPosParams(range.getLowerBound().getValue().get(), range.getUpperBound().getValue().get()) : new BitPosParams(range.getLowerBound().getValue().get()); } try { if (isPipelined()) { pipeline(connection.newJedisResult(params != null ? connection.getRequiredPipeline().bitpos(key, bit, params) : connection.getRequiredPipeline().bitpos(key, bit))); return null; } if (isQueueing()) { transaction( connection.newJedisResult(params != null ? connection.getRequiredTransaction().bitpos(key, bit, params) : connection.getRequiredTransaction().bitpos(key, bit))); return null; } return params != null ? connection.getJedis().bitpos(key, bit, params) : connection.getJedis().bitpos(key, bit); } catch (Exception ex) { throw convertJedisAccessException(ex); } }
@Nullable @Override public Long bitPos(byte[] key, boolean bit, Range<Long> range) { Assert.notNull(key, "Key must not be null!"); Assert.notNull(range, "Range must not be null! Use Range.unbounded() instead."); BitPosParams params = null; if (range.getLowerBound().isBounded()) { params = range.getUpperBound().isBounded() ? new BitPosParams(range.getLowerBound().getValue().get(), range.getUpperBound().getValue().get()) : new BitPosParams(range.getLowerBound().getValue().get()); } try { if (isPipelined()) { pipeline(connection.newJedisResult(params != null ? connection.getRequiredPipeline().bitpos(key, bit, params) : connection.getRequiredPipeline().bitpos(key, bit))); return null; } if (isQueueing()) { transaction( connection.newJedisResult(params != null ? connection.getRequiredTransaction().bitpos(key, bit, params) : connection.getRequiredTransaction().bitpos(key, bit))); return null; } return params != null ? connection.getJedis().bitpos(key, bit, params) : connection.getJedis().bitpos(key, bit); } catch (Exception ex) { throw convertJedisAccessException(ex); } }
@Override public Flux<NumericResponse<BitPosCommand, Long>> bitPos(Publisher<BitPosCommand> commands) { return connection.execute(cmd -> { return Flux.from(commands).flatMap(command -> { Mono<Long> result; Range<Long> range = command.getRange(); if (range.getLowerBound().isBounded()) { result = cmd.bitpos(command.getKey(), command.getBit(), getLowerValue(range)); if (range.getUpperBound().isBounded()) { result = cmd.bitpos(command.getKey(), command.getBit(), getLowerValue(range), getUpperValue(range)); } } else { result = cmd.bitpos(command.getKey(), command.getBit()); } return result.map(respValue -> new NumericResponse<>(command, respValue)); }); }); }
@Override public Flux<NumericResponse<BitPosCommand, Long>> bitPos(Publisher<BitPosCommand> commands) { return connection.execute(cmd -> { return Flux.from(commands).flatMap(command -> { Mono<Long> result; Range<Long> range = command.getRange(); if (range.getLowerBound().isBounded()) { result = cmd.bitpos(command.getKey(), command.getBit(), getLowerValue(range)); if (range.getUpperBound().isBounded()) { result = cmd.bitpos(command.getKey(), command.getBit(), getLowerValue(range), getUpperValue(range)); } } else { result = cmd.bitpos(command.getKey(), command.getBit()); } return result.map(respValue -> new NumericResponse<>(command, respValue)); }); }); }
@Override public Long bitPos(byte[] key, boolean bit, Range<Long> range) { Assert.notNull(key, "Key must not be null!"); Assert.notNull(range, "Range must not be null! Use Range.unbounded() instead."); List<byte[]> args = new ArrayList<>(3); args.add(LettuceConverters.toBit(bit)); if (range.getLowerBound().isBounded()) { args.add(range.getLowerBound().getValue().map(LettuceConverters::toBytes).get()); } if (range.getUpperBound().isBounded()) { args.add(range.getUpperBound().getValue().map(LettuceConverters::toBytes).get()); } return Long.class.cast(connection.execute("BITPOS", key, args)); }
@Override public Long bitPos(byte[] key, boolean bit, Range<Long> range) { Assert.notNull(key, "Key must not be null!"); Assert.notNull(range, "Range must not be null! Use Range.unbounded() instead."); List<byte[]> args = new ArrayList<>(3); args.add(LettuceConverters.toBit(bit)); if (range.getLowerBound().isBounded()) { args.add(range.getLowerBound().getValue().map(LettuceConverters::toBytes).get()); } if (range.getUpperBound().isBounded()) { args.add(range.getUpperBound().getValue().map(LettuceConverters::toBytes).get()); } return Long.class.cast(connection.execute("BITPOS", key, args)); }
@Override public Document toDocument() { Document doc = new Document(super.toDocument()); if (multipleOf != null) { doc.append("multipleOf", multipleOf); } if (range != null) { if (range.getLowerBound().isBounded()) { range.getLowerBound().getValue().ifPresent(it -> doc.append("minimum", it)); if (!range.getLowerBound().isInclusive()) { doc.append("exclusiveMinimum", true); } } if (range.getUpperBound().isBounded()) { range.getUpperBound().getValue().ifPresent(it -> doc.append("maximum", it)); if (!range.getUpperBound().isInclusive()) { doc.append("exclusiveMaximum", true); } } } return doc; }
RedisClusterAsyncCommands<byte[], byte[]> connection = getAsyncConnection(); if (range.getLowerBound().isBounded()) { if (range.getUpperBound().isBounded()) { futureResult = connection.bitpos(key, bit, getLowerValue(range), getUpperValue(range)); } else { if (range.getLowerBound().isBounded()) { if (range.getUpperBound().isBounded()) { return getConnection().bitpos(key, bit, getLowerValue(range), getUpperValue(range));
@Override public Flux<NumericResponse<BitPosCommand, Long>> bitPos(Publisher<BitPosCommand> commands) { return connection.execute(cmd -> { return Flux.from(commands).flatMap(command -> { Mono<Long> result; Range<Long> range = command.getRange(); if (range.getLowerBound().isBounded()) { result = cmd.bitpos(command.getKey(), command.getBit(), getLowerValue(range)); if (range.getUpperBound().isBounded()) { result = cmd.bitpos(command.getKey(), command.getBit(), getLowerValue(range), getUpperValue(range)); } } else { result = cmd.bitpos(command.getKey(), command.getBit()); } return result.map(respValue -> new NumericResponse<>(command, respValue)); }); }); }