io.lettuce.core.KeyValue.getKey()方法的使用及代码示例

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

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

KeyValue.getKey介绍

暂无

代码示例

代码示例来源:origin: lettuce-io/lettuce-core

/**
   * Returns a {@link KeyValue} consisting of the results of applying the given function to the value of this element. Mapping
   * is performed only if a {@link #hasValue() value is present}.
   *
   * @param <R> The element type of the new {@link KeyValue}
   * @param mapper a stateless function to apply to each element
   * @return the new {@link KeyValue}
   */
  @SuppressWarnings("unchecked")
  public <R> KeyValue<K, R> map(Function<? super V, ? extends R> mapper) {

    LettuceAssert.notNull(mapper, "Mapper function must not be null");

    if (hasValue()) {
      return new KeyValue<>(getKey(), mapper.apply(getValue()));
    }

    return (KeyValue<K, R>) this;
  }
}

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

@Override
public Flux<PopResponse> bPop(Publisher<BPopCommand> commands) {
  return connection.executeDedicated(cmd -> Flux.from(commands).concatMap(command -> {
    Assert.notNull(command.getKeys(), "Keys must not be null!");
    Assert.notNull(command.getDirection(), "Direction must not be null!");
    long timeout = command.getTimeout().get(ChronoUnit.SECONDS);
    Mono<PopResult> mappedMono = (ObjectUtils.nullSafeEquals(Direction.RIGHT, command.getDirection())
        ? cmd.brpop(timeout, command.getKeys().stream().toArray(ByteBuffer[]::new))
        : cmd.blpop(timeout, command.getKeys().stream().toArray(ByteBuffer[]::new)))
            .map(kv -> Arrays.asList(kv.getKey(), kv.getValue())).map(PopResult::new);
    return mappedMono.map(value -> new PopResponse(command, value));
  }));
}

代码示例来源:origin: lettuce-io/lettuce-core

"Cannot bind empty KeyValue to a Redis command."));
args.addKey(keyValue.getKey());
args.addValue(value);
return;

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

@Override
public Flux<PopResponse> bPop(Publisher<BPopCommand> commands) {
  return connection.executeDedicated(cmd -> Flux.from(commands).concatMap(command -> {
    Assert.notNull(command.getKeys(), "Keys must not be null!");
    Assert.notNull(command.getDirection(), "Direction must not be null!");
    long timeout = command.getTimeout().get(ChronoUnit.SECONDS);
    Mono<PopResult> mappedMono = (ObjectUtils.nullSafeEquals(Direction.RIGHT, command.getDirection())
        ? cmd.brpop(timeout, command.getKeys().stream().toArray(ByteBuffer[]::new))
        : cmd.blpop(timeout, command.getKeys().stream().toArray(ByteBuffer[]::new)))
            .map(kv -> Arrays.asList(kv.getKey(), kv.getValue())).map(PopResult::new);
    return mappedMono.map(value -> new PopResponse(command, value));
  }));
}

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

@Override
public Flux<PopResponse> bPop(Publisher<BPopCommand> commands) {
  return connection.executeDedicated(cmd -> Flux.from(commands).concatMap(command -> {
    Assert.notNull(command.getKeys(), "Keys must not be null!");
    Assert.notNull(command.getDirection(), "Direction must not be null!");
    long timeout = command.getTimeout().get(ChronoUnit.SECONDS);
    Mono<PopResult> mappedMono = (ObjectUtils.nullSafeEquals(Direction.RIGHT, command.getDirection())
        ? cmd.brpop(timeout, command.getKeys().stream().toArray(ByteBuffer[]::new))
        : cmd.blpop(timeout, command.getKeys().stream().toArray(ByteBuffer[]::new)))
            .map(kv -> Arrays.asList(kv.getKey(), kv.getValue())).map(PopResult::new);
    return mappedMono.map(value -> new PopResponse(command, value));
  }));
}

代码示例来源:origin: io.lettuce/lettuce-core

/**
   * Returns a {@link KeyValue} consisting of the results of applying the given function to the value of this element. Mapping
   * is performed only if a {@link #hasValue() value is present}.
   *
   * @param <R> The element type of the new {@link KeyValue}
   * @param mapper a stateless function to apply to each element
   * @return the new {@link KeyValue}
   */
  @SuppressWarnings("unchecked")
  public <R> KeyValue<K, R> map(Function<? super V, ? extends R> mapper) {

    LettuceAssert.notNull(mapper, "Mapper function must not be null");

    if (hasValue()) {
      return new KeyValue<>(getKey(), mapper.apply(getValue()));
    }

    return (KeyValue<K, R>) this;
  }
}

代码示例来源:origin: io.lettuce/lettuce-core

"Cannot bind empty KeyValue to a Redis command."));
args.addKey(keyValue.getKey());
args.addValue(value);
return;

相关文章

微信公众号

最新文章

更多