Example usage for org.springframework.data.redis.connection RedisConnection pTtl

List of usage examples for org.springframework.data.redis.connection RedisConnection pTtl

Introduction

In this page you can find the example usage for org.springframework.data.redis.connection RedisConnection pTtl.

Prototype

@Nullable
Long pTtl(byte[] key);

Source Link

Document

Get the precise time to live for key in milliseconds.

Usage

From source file:com.zxy.commons.cache.RedisUtils.java

/**
 * Get the time to live for {@code key} in milliseconds.
 * <p>//  ww w  .  ja  v  a2 s. c  o m
 * See http://redis.io/commands/pttl
 * 
 * @param key key
 * @return Long
 */
public static Long pTtl(byte[] key) {
    return redisTemplate.execute(new RedisCallback<Long>() {
        @Override
        public Long doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.pTtl(key);
        }
    });
}

From source file:com.zxy.commons.cache.RedisHelper.java

/**
 * Get the time to live for {@code key} in milliseconds.
 * <p>//from  w w w.j a  v  a  2 s.  c o  m
 * See http://redis.io/commands/pttl
 * 
 * @param key key
 * @return Long
 */
public Long pTtl(byte[] key) {
    return redisTemplate.execute(new RedisCallback<Long>() {
        @Override
        public Long doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.pTtl(key);
        }
    });
}