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

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

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

Pipeline.expire介绍

暂无

代码示例

代码示例来源:origin: sohutv/cachecloud

@Override
public void pipelineCommand(Pipeline pipeline, List<String> pipelineKeys) {
  for (String key : pipelineKeys) {
    Integer seconds = keyTimeMap.get(key);
    pipeline.expire(key, seconds);
  }
}

代码示例来源:origin: apache/storm

pipeline.expire(additionalKey, expireIntervalSec);

代码示例来源:origin: qiujiayu/AutoLoadCache

@Override
public void hset(byte[] key, byte[] field, byte[] value, int seconds) {
  Jedis jedis = shardedJedis.getShard(key);
  Pipeline pipeline = jedis.pipelined();
  pipeline.hset(key, field, value);
  pipeline.expire(key, seconds);
  pipeline.sync();
}

代码示例来源:origin: apache/storm

Pipeline pipe = jedis.pipelined();
for (int i = 0; i < keyValue.length; i += 2) {
  pipe.expire(keyValue[i], this.options.expireIntervalSec);

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

@Override
public Boolean expire(byte[] key, long seconds) {
  Assert.notNull(key, "Key must not be null!");
  if (seconds > Integer.MAX_VALUE) {
    return pExpire(key, TimeUnit.SECONDS.toMillis(seconds));
  }
  try {
    if (isPipelined()) {
      pipeline(connection.newJedisResult(connection.getRequiredPipeline().expire(key, (int) seconds),
          JedisConverters.longToBoolean()));
      return null;
    }
    if (isQueueing()) {
      transaction(connection.newJedisResult(connection.getRequiredTransaction().expire(key, (int) seconds),
          JedisConverters.longToBoolean()));
      return null;
    }
    return JedisConverters.toBoolean(connection.getJedis().expire(key, (int) seconds));
  } catch (Exception ex) {
    throw connection.convertJedisAccessException(ex);
  }
}

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

@Override
public Response<Long> expire(String key, int seconds) {
 String command = "expire";
 return instrumented(command, () -> delegated.expire(key, seconds));
}

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

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

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

@Override
  Response<Long> execute(final Pipeline jedisPipeline) throws DynoException {
    long startTime = System.nanoTime() / 1000;
    try {
      return jedisPipeline.expire(key, seconds);
    } finally {
      long duration = System.nanoTime() / 1000 - startTime;
      opMonitor.recordSendLatency(OpName.EXPIRE.name(), duration, TimeUnit.MICROSECONDS);
    }
  }
}.execute(key, OpName.EXPIRE);

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

@Override
  Long execute() {
    Pipeline pipeline = jedis.getShard(key).pipelined();
    Response<Long> result = pipeline.hset(key.getBytes(), field.getBytes(), SerializeUtil.serialize(value));
    pipeline.expire(key, expire);
    pipeline.sync();
    return result.get();
  }
}.getResult();

代码示例来源:origin: com.coveo/spillway

pipeline.expire(redisKey, (int) request.getExpiration().getSeconds() * 2);
pipeline.exec();

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

@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();

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

@Override
  List<String> execute() {
    Pipeline pipeline = jedis.getShard(key).pipelined();
    Response<List<String>> result = pipeline.hmget(key, fields);
    pipeline.expire(key, expire);
    pipeline.sync();
    return result.get();
  }
}.getResult();

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

@Override
  Long execute() {
    Pipeline pipeline = jedis.getShard(key).pipelined();
    Response<Long> result = pipeline.hlen(key);
    pipeline.expire(key, expire);
    pipeline.sync();
    return result.get();
  }
}.getResult();

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

@Override
  Set<String> execute() {
    Pipeline pipeline = jedis.getShard(key).pipelined();
    Response<Set<String>> result = pipeline.hkeys(key);
    pipeline.expire(key, expire);
    pipeline.sync();
    return result.get();
  }
}.getResult();

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

@Override
  Map<String, String> execute() {
    Pipeline pipeline = jedis.getShard(key).pipelined();
    Response<Map<String, String>> result = pipeline.hgetAll(key);
    pipeline.expire(key, expire);
    pipeline.sync();
    return result.get();
  }
}.getResult();

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

@Override
  Long execute() {
    Pipeline pipeline = jedis.getShard(key).pipelined();
    Response<Long> result = pipeline.hset(key, field, value);
    pipeline.expire(key, expire);
    pipeline.sync();
    return result.get();
  }
}.getResult();

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

@Override
  String execute() {
    Pipeline pipeline = jedis.getShard(key).pipelined();
    Response<String> result = pipeline.hmset(key, hash);
    pipeline.expire(key, expire);
    pipeline.sync();
    return result.get();
  }
}.getResult();

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

@Override
public Boolean expire(byte[] key, long seconds) {
  Assert.notNull(key, "Key must not be null!");
  if (seconds > Integer.MAX_VALUE) {
    return pExpire(key, TimeUnit.SECONDS.toMillis(seconds));
  }
  try {
    if (isPipelined()) {
      pipeline(connection.newJedisResult(connection.getRequiredPipeline().expire(key, (int) seconds),
          JedisConverters.longToBoolean()));
      return null;
    }
    if (isQueueing()) {
      transaction(connection.newJedisResult(connection.getRequiredTransaction().expire(key, (int) seconds),
          JedisConverters.longToBoolean()));
      return null;
    }
    return JedisConverters.toBoolean(connection.getJedis().expire(key, (int) seconds));
  } catch (Exception ex) {
    throw connection.convertJedisAccessException(ex);
  }
}

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

@Override
public Boolean expire(byte[] key, long seconds) {
  Assert.notNull(key, "Key must not be null!");
  if (seconds > Integer.MAX_VALUE) {
    return pExpire(key, TimeUnit.SECONDS.toMillis(seconds));
  }
  try {
    if (isPipelined()) {
      pipeline(connection.newJedisResult(connection.getRequiredPipeline().expire(key, (int) seconds),
          JedisConverters.longToBoolean()));
      return null;
    }
    if (isQueueing()) {
      transaction(connection.newJedisResult(connection.getRequiredTransaction().expire(key, (int) seconds),
          JedisConverters.longToBoolean()));
      return null;
    }
    return JedisConverters.toBoolean(connection.getJedis().expire(key, (int) seconds));
  } catch (Exception ex) {
    throw connection.convertJedisAccessException(ex);
  }
}

相关文章

Pipeline类方法