List of usage examples for org.springframework.data.redis.connection RedisConnection ttl
@Nullable
Long ttl(byte[] key);
From source file:com.zxy.commons.cache.RedisUtils.java
/** * Get the time to live for {@code key} in seconds. * <p>/*from w w w .j ava 2 s. c o m*/ * See http://redis.io/commands/ttl * * @param key key * @return Long */ public static Long ttl(byte[] key) { return redisTemplate.execute(new RedisCallback<Long>() { @Override public Long doInRedis(RedisConnection redis) throws DataAccessException { return redis.ttl(key); } }); }
From source file:com.zxy.commons.cache.RedisHelper.java
/** * Get the time to live for {@code key} in seconds. * <p>//from w w w. j a va 2s .co m * See http://redis.io/commands/ttl * * @param key key * @return Long */ public Long ttl(byte[] key) { return redisTemplate.execute(new RedisCallback<Long>() { @Override public Long doInRedis(RedisConnection redis) throws DataAccessException { return redis.ttl(key); } }); }