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

x33g5p2x  于2022-01-21 转载在 其他  
字(5.5k)|赞(0)|评价(0)|浏览(118)

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

Jedis.pttl介绍

暂无

代码示例

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

@Override
public Long pttl(String key) {
 Jedis j = getShard(key);
 return j.pttl(key);
}

代码示例来源:origin: wuyouzhuguli/FEBS-Shiro

@Override
public Long pttl(String key) {
  return (Long) this.excuteByJedis(j -> j.pttl(key));
}

代码示例来源:origin: Netflix/conductor

@Override
public Long pttl(String key) {
 Jedis jedis = null;
 try {
  jedis = jedisPool.getResource();
  return jedis.pttl(key);
 } finally {
  if (jedis != null)
   jedis.close();
 }
}

代码示例来源:origin: jfinal/jfinal

/**
 * 这个命令类似于 TTL 命令,但它以毫秒为单位返回 key 的剩余生存时间,而不是像 TTL 命令那样,以秒为单位。
 */
public Long pttl(Object key) {
  Jedis jedis = getJedis();
  try {
    return jedis.pttl(keyToBytes(key));
  }
  finally {close(jedis);}
}

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

@Override
public Long pTtl(byte[] key) {
  Assert.notNull(key, "Key must not be null!");
  return connection.getClusterCommandExecutor()
      .executeCommandOnSingleNode((JedisClusterCommandCallback<Long>) client -> client.pttl(key),
          connection.getTopologyProvider().getTopology().getKeyServingMasterNode(key))
      .getValue();
}

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

@Override
public Long pTtl(byte[] key, TimeUnit timeUnit) {
  Assert.notNull(key, "Key must not be null!");
  return connection.getClusterCommandExecutor()
      .executeCommandOnSingleNode(
          (JedisClusterCommandCallback<Long>) client -> Converters.millisecondsToTimeUnit(client.pttl(key), timeUnit),
          connection.getTopologyProvider().getTopology().getKeyServingMasterNode(key))
      .getValue();
}

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

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

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

@Override
public Long pTtl(byte[] key, TimeUnit timeUnit) {
  Assert.notNull(key, "Key must not be null!");
  try {
    if (isPipelined()) {
      pipeline(connection.newJedisResult(connection.getRequiredPipeline().pttl(key),
          Converters.millisecondsToTimeUnit(timeUnit)));
      return null;
    }
    if (isQueueing()) {
      transaction(connection.newJedisResult(connection.getRequiredTransaction().pttl(key),
          Converters.millisecondsToTimeUnit(timeUnit)));
      return null;
    }
    return Converters.millisecondsToTimeUnit(connection.getJedis().pttl(key), timeUnit);
  } catch (Exception ex) {
    throw connection.convertJedisAccessException(ex);
  }
}

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

@Override
 public Long execute(Jedis connection) {
  return connection.pttl(key);
 }
}.run(key);

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

@Override
public Long pttl(String key) {
 String command = "pttl";
 return instrumented(command, () -> delegated.pttl(key));
}

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

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

代码示例来源:origin: org.nutz/nutz-integration-jedis

public Long pttl(byte[] key) {
  Jedis jedis = getJedis();
  try {
    return jedis.pttl(key);
  } finally {Streams.safeClose(jedis);}
}

代码示例来源:origin: org.nutz/nutz-integration-jedis

public Long pttl(String key) {
  Jedis jedis = getJedis();
  try {
    return jedis.pttl(key);
  } finally {Streams.safeClose(jedis);}
}

代码示例来源:origin: com.netflix.conductor/conductor-redis-persistence

@Override
public Long pttl(String key) {
 Jedis jedis = null;
 try {
  jedis = jedisPool.getResource();
  return jedis.pttl(key);
 } finally {
  if (jedis != null)
   jedis.close();
 }
}

代码示例来源:origin: yangfuhai/jboot

/**
 * 这个命令类似于 TTL 命令,但它以毫秒为单位返回 key 的剩余生存时间,而不是像 TTL 命令那样,以秒为单位。
 */
public Long pttl(Object key) {
  Jedis jedis = getJedis();
  try {
    return jedis.pttl(keyToBytes(key));
  } finally {
    returnResource(jedis);
  }
}

代码示例来源:origin: com.jfinal/jfinal

/**
 * 这个命令类似于 TTL 命令,但它以毫秒为单位返回 key 的剩余生存时间,而不是像 TTL 命令那样,以秒为单位。
 */
public Long pttl(Object key) {
  Jedis jedis = getJedis();
  try {
    return jedis.pttl(keyToBytes(key));
  }
  finally {close(jedis);}
}

代码示例来源:origin: com.github.sogyf/goja-jfinal

/**
 * 这个命令类似于 TTL 命令,但它以毫秒为单位返回 key 的剩余生存时间,而不是像 TTL 命令那样,以秒为单位。
 */
public Long pttl(Object key) {
  Jedis jedis = getJedis();
  try {
    return jedis.pttl(keyToBytes(key));
  }
  finally {close(jedis);}
}

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

@Override
public Long pTtl(byte[] key) {
  Assert.notNull(key, "Key must not be null!");
  return connection.getClusterCommandExecutor()
      .executeCommandOnSingleNode((JedisClusterCommandCallback<Long>) client -> client.pttl(key),
          connection.getTopologyProvider().getTopology().getKeyServingMasterNode(key))
      .getValue();
}

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

@Override
public Long pTtl(byte[] key) {
  Assert.notNull(key, "Key must not be null!");
  return connection.getClusterCommandExecutor()
      .executeCommandOnSingleNode((JedisClusterCommandCallback<Long>) client -> client.pttl(key),
          connection.getTopologyProvider().getTopology().getKeyServingMasterNode(key))
      .getValue();
}

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

@Override
public Long pTtl(byte[] key, TimeUnit timeUnit) {
  Assert.notNull(key, "Key must not be null!");
  return connection.getClusterCommandExecutor()
      .executeCommandOnSingleNode(
          (JedisClusterCommandCallback<Long>) client -> Converters.millisecondsToTimeUnit(client.pttl(key), timeUnit),
          connection.getTopologyProvider().getTopology().getKeyServingMasterNode(key))
      .getValue();
}

相关文章

微信公众号

最新文章

更多

Jedis类方法