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

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

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

Pipeline.lpush介绍

暂无

代码示例

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

@Override
public Long lPush(byte[] key, byte[]... values) {
  Assert.notNull(key, "Key must not be null!");
  Assert.notNull(values, "Values must not be null!");
  Assert.noNullElements(values, "Values must not contain null elements!");
  try {
    if (isPipelined()) {
      pipeline(connection.newJedisResult(connection.getRequiredPipeline().lpush(key, values)));
      return null;
    }
    if (isQueueing()) {
      transaction(connection.newJedisResult(connection.getRequiredTransaction().lpush(key, values)));
      return null;
    }
    return connection.getJedis().lpush(key, values);
  } catch (Exception ex) {
    throw convertJedisAccessException(ex);
  }
}

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

@Override
Response<Long> execute(Pipeline jedisPipeline) throws DynoException {
  return jedisPipeline.lpush(key, string);
}

代码示例来源:origin: dqeasycloud/easy-cloud

@Override
  public Object doInRedis(RedisConnection connection) throws DataAccessException {
    Jedis jedis = (Jedis) connection.getNativeConnection();
    jedis.pipelined().lpush("", "");
    return null;
  }
};

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

@Override
public Response<Long> lpush(String key, String... string) {
 String command = "lpush";
 return instrumented(command, payloadSize(string), () -> delegated.lpush(key, string));
}

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

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

代码示例来源:origin: org.apache.beam/beam-sdks-java-io-redis

private void writeUsingListCommand(
  KV<String, String> record, Method method, Long expireTime) {
 String key = record.getKey();
 String value = record.getValue();
 if (Method.LPUSH == method) {
  pipeline.lpush(key, value);
 } else if (Method.RPUSH == method) {
  pipeline.rpush(key, value);
 }
 setExpireTimeWhenRequired(key, expireTime);
}

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

@Override
  Long execute() {
    Pipeline pipeline = jedis.getShard(key).pipelined();
    Response<Long> result = pipeline.lpush(key, value);
    // 修剪列表元素, 如果 size - 1 比 end 下标还要大,Redis将 size 的值设置为 end 。
    pipeline.ltrim(key, 0, size - 1);
    pipeline.sync();
    return result.get();
  }
}.getResult();

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

@Override
public Long lPush(byte[] key, byte[]... values) {
  Assert.notNull(key, "Key must not be null!");
  Assert.notNull(values, "Values must not be null!");
  Assert.noNullElements(values, "Values must not contain null elements!");
  try {
    if (isPipelined()) {
      pipeline(connection.newJedisResult(connection.getRequiredPipeline().lpush(key, values)));
      return null;
    }
    if (isQueueing()) {
      transaction(connection.newJedisResult(connection.getRequiredTransaction().lpush(key, values)));
      return null;
    }
    return connection.getJedis().lpush(key, values);
  } catch (Exception ex) {
    throw convertJedisAccessException(ex);
  }
}

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

@Override
public Long lPush(byte[] key, byte[]... values) {
  Assert.notNull(key, "Key must not be null!");
  Assert.notNull(values, "Values must not be null!");
  Assert.noNullElements(values, "Values must not contain null elements!");
  try {
    if (isPipelined()) {
      pipeline(connection.newJedisResult(connection.getRequiredPipeline().lpush(key, values)));
      return null;
    }
    if (isQueueing()) {
      transaction(connection.newJedisResult(connection.getRequiredTransaction().lpush(key, values)));
      return null;
    }
    return connection.getJedis().lpush(key, values);
  } catch (Exception ex) {
    throw convertJedisAccessException(ex);
  }
}

代码示例来源:origin: gojektech/feast

private Response<?> writeRecord(RedisMutation mutation) {
 switch (mutation.getMethod()) {
  case APPEND:
   return pipeline.append(mutation.getKey(), mutation.getValue());
  case SET:
   return pipeline.set(mutation.getKey(), mutation.getValue());
  case LPUSH:
   return pipeline.lpush(mutation.getKey(), mutation.getValue());
  case RPUSH:
   return pipeline.rpush(mutation.getKey(), mutation.getValue());
  case SADD:
   return pipeline.sadd(mutation.getKey(), mutation.getValue());
  case ZADD:
   return pipeline.zadd(mutation.getKey(), mutation.getScore(), mutation.getValue());
  default:
   throw new UnsupportedOperationException(
     String.format("Not implemented writing records for %s", mutation.getMethod()));
 }
}

相关文章

Pipeline类方法