本文整理了Java中redis.clients.jedis.Jedis.expireAt()
方法的一些代码示例,展示了Jedis.expireAt()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Jedis.expireAt()
方法的具体详情如下:
包路径:redis.clients.jedis.Jedis
类名称:Jedis
方法名:expireAt
[英]EXPIREAT works exactly like #expire(String,int) but instead to get the number of seconds representing the Time To Live of the key as a second argument (that is a relative way of specifying the TTL), it takes an absolute one in the form of a UNIX timestamp (Number of seconds elapsed since 1 Gen 1970).
EXPIREAT was introduced in order to implement the Append Only File persistence mode so that EXPIRE commands are automatically translated into EXPIREAT commands for the append only file. Of course EXPIREAT can also used by programmers that need a way to simply specify that a given key should expire at a given time in the future.
Since Redis 2.1.3 you can update the value of the timeout of a key already having an expire set. It is also possible to undo the expire at all turning the key into a normal key using the #persist(String) command.
Time complexity: O(1)
[中]EXPIREAT的工作原理与#expire(String,int)完全相同,但为了将表示密钥生存时间的秒数作为第二个参数(这是指定TTL的相对方式),它采用UNIX时间戳形式的绝对秒数(自1970年第1代以来经过的秒数)。
引入EXPIREAT是为了实现仅附加文件持久化模式,以便EXPIRE命令自动转换为仅附加文件的EXPIREAT命令。当然,EXPIREAT也可以被程序员使用,他们需要一种方法来简单地指定一个给定的键应该在将来的某个给定时间过期。
由于Redis 2.1.3,您可以更新已设置过期的密钥的超时值。还可以使用#persist(String)命令将密钥转换为普通密钥,从而完全撤消过期。
时间复杂度:O(1)
代码示例来源:origin: sohutv/cachecloud
@Override
public Long execute(Jedis connection) {
return connection.expireAt(key, unixTime);
}
}.runBinary(key);
代码示例来源:origin: sohutv/cachecloud
@Override
public Long execute(Jedis connection) {
return connection.expireAt(key, unixTime);
}
}.run(key);
代码示例来源:origin: sohutv/cachecloud
@Override
public Long expireAt(byte[] key, long unixTime) {
Jedis j = getShard(key);
return j.expireAt(key, unixTime);
}
代码示例来源:origin: sohutv/cachecloud
@Override
public Long expireAt(String key, long unixTime) {
Jedis j = getShard(key);
return j.expireAt(key, unixTime);
}
代码示例来源:origin: Netflix/conductor
@Override
public Long expireAt(String key, long unixTime) {
Jedis jedis = null;
try {
jedis = jedisPool.getResource();
return jedis.expireAt(key, unixTime);
} finally {
if (jedis != null)
jedis.close();
}
}
代码示例来源:origin: jfinal/jfinal
/**
* EXPIREAT 的作用和 EXPIRE 类似,都用于为 key 设置生存时间。不同在于 EXPIREAT 命令接受的时间参数是 UNIX 时间戳(unix timestamp)。
*/
public Long expireAt(Object key, long unixTime) {
Jedis jedis = getJedis();
try {
return jedis.expireAt(keyToBytes(key), unixTime);
}
finally {close(jedis);}
}
代码示例来源:origin: spring-projects/spring-data-redis
@Override
public Boolean expireAt(byte[] key, long unixTime) {
Assert.notNull(key, "Key must not be null!");
try {
if (isPipelined()) {
pipeline(connection.newJedisResult(connection.getRequiredPipeline().expireAt(key, unixTime),
JedisConverters.longToBoolean()));
return null;
}
if (isQueueing()) {
transaction(connection.newJedisResult(connection.getRequiredTransaction().expireAt(key, unixTime),
JedisConverters.longToBoolean()));
return null;
}
return JedisConverters.toBoolean(connection.getJedis().expireAt(key, unixTime));
} catch (Exception ex) {
throw connection.convertJedisAccessException(ex);
}
}
代码示例来源:origin: apache/servicemix-bundles
@Override
public Long execute(Jedis connection) {
return connection.expireAt(key, unixTime);
}
}.run(key);
代码示例来源:origin: io.leopard/leopard-redis
@Override
public Object execute(Jedis jedis) {
return jedis.expireAt(key, unixTime);
}
});
代码示例来源:origin: apache/servicemix-bundles
@Override
public Long execute(Jedis connection) {
return connection.expireAt(key, unixTime);
}
}.runBinary(key);
代码示例来源:origin: yrain/smart-cache
@Override
Long doInJedis(Jedis jedis) {
return jedis.expireAt(key, unixTime);
}
});
代码示例来源:origin: com.netflix.spinnaker.kork/kork-jedis
@Override
public Long expireAt(String key, long unixTime) {
String command = "expireAt";
return instrumented(command, () -> delegated.expireAt(key, unixTime));
}
代码示例来源:origin: com.netflix.spinnaker.kork/kork-jedis
@Override
public Long expireAt(byte[] key, long unixTime) {
String command = "expireAt";
return instrumented(command, () -> delegated.expireAt(key, unixTime));
}
代码示例来源:origin: apache/servicemix-bundles
@Override
public Long expireAt(final byte[] key, final long unixTime) {
Jedis j = getShard(key);
return j.expireAt(key, unixTime);
}
代码示例来源:origin: com.github.yamingd.argo/argo-redis
public Long execute(final Jedis conn) throws Exception {
return conn.expireAt(SafeEncoder.encode(key), ts);
}
});
代码示例来源:origin: apache/servicemix-bundles
@Override
public Long expireAt(final String key, final long unixTime) {
Jedis j = getShard(key);
return j.expireAt(key, unixTime);
}
代码示例来源:origin: com.netflix.conductor/conductor-redis-persistence
@Override
public Long expireAt(String key, long unixTime) {
Jedis jedis = null;
try {
jedis = jedisPool.getResource();
return jedis.expireAt(key, unixTime);
} finally {
if (jedis != null)
jedis.close();
}
}
代码示例来源:origin: yangfuhai/jboot
/**
* EXPIREAT 的作用和 EXPIRE 类似,都用于为 key 设置生存时间。不同在于 EXPIREAT 命令接受的时间参数是 UNIX 时间戳(unix timestamp)。
*/
public Long expireAt(Object key, long unixTime) {
Jedis jedis = getJedis();
try {
return jedis.expireAt(keyToBytes(key), unixTime);
} finally {
returnResource(jedis);
}
}
代码示例来源:origin: com.jfinal/jfinal
/**
* EXPIREAT 的作用和 EXPIRE 类似,都用于为 key 设置生存时间。不同在于 EXPIREAT 命令接受的时间参数是 UNIX 时间戳(unix timestamp)。
*/
public Long expireAt(Object key, long unixTime) {
Jedis jedis = getJedis();
try {
return jedis.expireAt(keyToBytes(key), unixTime);
}
finally {close(jedis);}
}
代码示例来源:origin: com.github.sogyf/goja-jfinal
/**
* EXPIREAT 的作用和 EXPIRE 类似,都用于为 key 设置生存时间。不同在于 EXPIREAT 命令接受的时间参数是 UNIX 时间戳(unix timestamp)。
*/
public Long expireAt(Object key, long unixTime) {
Jedis jedis = getJedis();
try {
return jedis.expireAt(keyToBytes(key), unixTime);
}
finally {close(jedis);}
}
内容来源于网络,如有侵权,请联系作者删除!