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

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

Introduction

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

Prototype

@Nullable
Boolean pExpire(byte[] key, long millis);

Source Link

Document

Set time to live for given key in milliseconds.

Usage

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

/**
 * Set time to live for given {@code key} in milliseconds.
 * <p>/*from   w w  w .ja  va2  s  .  c o m*/
 * See http://redis.io/commands/pexpire
 * 
 * @param key key
 * @param millis millis
 * @return Boolean
 */
public static Boolean pExpire(byte[] key, long millis) {
    return redisTemplate.execute(new RedisCallback<Boolean>() {
        @Override
        public Boolean doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.pExpire(key, millis);
        }
    });
}

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

/**
 * Set time to live for given {@code key} in milliseconds.
 * <p>//from   w w w  .  j a v  a  2  s.c  o  m
 * See http://redis.io/commands/pexpire
 * 
 * @param key key
 * @param millis millis
 * @return Boolean
 */
public Boolean pExpire(byte[] key, long millis) {
    return redisTemplate.execute(new RedisCallback<Boolean>() {
        @Override
        public Boolean doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.pExpire(key, millis);
        }
    });
}