本文整理了Java中redis.clients.jedis.Pipeline.set()
方法的一些代码示例,展示了Pipeline.set()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Pipeline.set()
方法的具体详情如下:
包路径:redis.clients.jedis.Pipeline
类名称:Pipeline
方法名:set
暂无
代码示例来源:origin: sohutv/cachecloud
@Override
public void pipelineCommand(Pipeline pipeline, List<String> pipelineKeys) {
for (String key : pipelineKeys) {
String value = keyValueMap.get(key);
pipeline.set(key, value);
}
}
代码示例来源:origin: apache/storm
pipeline.setex(key, expireIntervalSec, value);
} else {
pipeline.set(key, value);
代码示例来源:origin: sohutv/cachecloud
@Override
public void pipelineCommand(Pipeline pipeline, List<String> pipelineKeys) {
for (String key : pipelineKeys) {
byte[] value = keyValueMap.get(key);
pipeline.set(SafeEncoder.encode(key), value);
}
}
代码示例来源:origin: spring-projects/spring-data-redis
@Override
public Boolean set(byte[] key, byte[] value) {
Assert.notNull(key, "Key must not be null!");
Assert.notNull(value, "Value must not be null!");
try {
if (isPipelined()) {
pipeline(connection.newJedisResult(connection.getRequiredPipeline().set(key, value),
Converters.stringToBooleanConverter()));
return null;
}
if (isQueueing()) {
transaction(connection.newJedisResult(connection.getRequiredTransaction().set(key, value),
Converters.stringToBooleanConverter()));
return null;
}
return Converters.stringToBoolean(connection.getJedis().set(key, value));
} catch (Exception ex) {
throw convertJedisAccessException(ex);
}
}
代码示例来源:origin: spring-projects/spring-data-redis
pipeline(connection.newJedisResult(connection.getRequiredPipeline().set(key, value, nxxx),
Converters.stringToBooleanConverter(), () -> false));
return null;
connection.getRequiredPipeline().set(key, value, params),
Converters.stringToBooleanConverter(), () -> false));
return null;
代码示例来源:origin: com.netflix.dyno/dyno-jedis
@Override
Response<String> execute(Pipeline jedisPipeline) throws DynoException {
long startTime = System.nanoTime() / 1000;
try {
return jedisPipeline.set(key, value);
} finally {
long duration = System.nanoTime() / 1000 - startTime;
opMonitor.recordSendLatency(OpName.SET.name(), duration, TimeUnit.MICROSECONDS);
}
}
代码示例来源:origin: com.netflix.dyno/dyno-jedis
@Override
Response<String> execute(Pipeline jedisPipeline) throws DynoException {
long startTime = System.nanoTime() / 1000;
try {
return jedisPipeline.set(key, value);
} finally {
long duration = System.nanoTime() / 1000 - startTime;
opMonitor.recordSendLatency(OpName.SET.name(), duration, TimeUnit.MICROSECONDS);
}
}
代码示例来源:origin: intsmaze/intsmaze
@Test
public void testPipelined() {
Pipeline pipeline = jedis.pipelined();
long start = System.currentTimeMillis();
for (int i = 0; i < 1000; i++) {
pipeline.set("p" + i, "p" + i);
}
//System.out.println(pipeline.get("p1000").get());
List<Object> results = pipeline.syncAndReturnAll();
long end = System.currentTimeMillis();
System.out.println("Pipelined SET: " + ((end - start)/1000.0) + " seconds");
}
代码示例来源:origin: CodisLabs/nedis
private void testPipeline(byte[] key, byte[] value) {
while (!stop.get()) {
try (Jedis jedis = pool.getResource()) {
Pipeline p = jedis.pipelined();
for (int i = 0; i < pipeline / 2; i++) {
p.set(key, value);
p.get(key);
}
p.sync();
reqCount.addAndGet(pipeline);
}
}
}
代码示例来源:origin: com.netflix.spinnaker.kork/kork-jedis
@Override
public Response<String> set(String key, String value) {
String command = "set";
return instrumented(command, payloadSize(value), () -> delegated.set(key, value));
}
代码示例来源:origin: com.netflix.spinnaker.kork/kork-jedis
@Override
public Response<String> set(byte[] key, byte[] value, byte[] nxxx) {
String command = "set";
return instrumented(command, payloadSize(value), () -> delegated.set(key, value, nxxx));
}
代码示例来源:origin: com.netflix.spinnaker.kork/kork-jedis
@Override
public Response<String> set(byte[] key, byte[] value) {
String command = "set";
return instrumented(command, payloadSize(value), () -> delegated.set(key, value));
}
代码示例来源:origin: com.netflix.spinnaker.kork/kork-jedis
@Override
public Response<String> set(byte[] key, byte[] value, byte[] nxxx, byte[] expx, int time) {
String command = "set";
return instrumented(command, payloadSize(value), () -> delegated.set(key, value, nxxx, expx, time));
}
代码示例来源:origin: com.netflix.spinnaker.kork/kork-jedis
@Override
public Response<String> set(String key, String value, String nxxx) {
String command = "set";
return instrumented(command, payloadSize(value), () -> delegated.set(key, value, nxxx));
}
代码示例来源:origin: com.netflix.spinnaker.kork/kork-jedis
@Override
public Response<String> set(String key, String value, String nxxx, String expx, int time) {
String command = "set";
return instrumented(command, payloadSize(value), () -> delegated.set(key, value, nxxx, expx, time));
}
代码示例来源:origin: intsmaze/intsmaze
@Test
public void testPipelineTrans() {
long start = System.currentTimeMillis();
Pipeline pipeline = jedis.pipelined();
pipeline.multi();
for (int i = 0; i < 100000; i++) {
pipeline.set("" + i, "" + i);
}
pipeline.exec();
List<Object> results = pipeline.syncAndReturnAll();
long end = System.currentTimeMillis();
System.out.println("Pipelined transaction SET: " + ((end - start)/1000.0) + " seconds");
}
代码示例来源:origin: biezhi/java-library-examples
public static void main(String[] args) {
try (Jedis jedis = JedisUtil.getInstance().getJedis()) {
long start = System.currentTimeMillis();
jedis.flushDB();
Pipeline p = jedis.pipelined();
for (int i = 0; i < 10000; i++) {
p.set("age2" + i, i + "");
System.out.println(p.get("age2" + i));
}
p.sync();// 这段代码获取所有的response
long end = System.currentTimeMillis();
System.out.println("use pipeline cost:" + (end - start) + "ms");
}
}
代码示例来源:origin: org.apache.beam/beam-sdks-java-io-redis
private void writeUsingSetCommand(KV<String, String> record, Long expireTime) {
String key = record.getKey();
String value = record.getValue();
if (expireTime != null) {
pipeline.psetex(key, expireTime, value);
} else {
pipeline.set(key, value);
}
}
代码示例来源:origin: pyloque/captain
public void set(KvItem item) {
redis.pipeline(pipe -> {
pipe.set(keyForItem(item.getKey()), item.getValue().toString());
pipe.sadd(globalAllKeys, item.getKey());
pipe.incr(keyForVersion(item.getKey()));
pipe.incr(globalVersionKey);
});
}
代码示例来源:origin: org.springframework.data/spring-data-redis
@Override
public Boolean set(byte[] key, byte[] value) {
Assert.notNull(key, "Key must not be null!");
Assert.notNull(value, "Value must not be null!");
try {
if (isPipelined()) {
pipeline(connection.newJedisResult(connection.getRequiredPipeline().set(key, value),
Converters.stringToBooleanConverter()));
return null;
}
if (isQueueing()) {
transaction(connection.newJedisResult(connection.getRequiredTransaction().set(key, value),
Converters.stringToBooleanConverter()));
return null;
}
return Converters.stringToBoolean(connection.getJedis().set(key, value));
} catch (Exception ex) {
throw convertJedisAccessException(ex);
}
}
内容来源于网络,如有侵权,请联系作者删除!