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

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

Introduction

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

Prototype

@Nullable
Boolean expireAt(byte[] key, long unixTime);

Source Link

Document

Set the expiration for given key as a UNIX timestamp.

Usage

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

/**
 * Set the expiration for given {@code key} as a {@literal UNIX} timestamp.
 * <p>//  ww w.  jav  a 2 s .  c  o  m
 * See http://redis.io/commands/expireat
 * 
 * @param key key
 * @param unixTime unixTime
 * @return Boolean
 */
public static Boolean expireAt(byte[] key, long unixTime) {
    return redisTemplate.execute(new RedisCallback<Boolean>() {
        @Override
        public Boolean doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.expireAt(key, unixTime);
        }
    });
}

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

/**
 * Set the expiration for given {@code key} as a {@literal UNIX} timestamp.
 * <p>/*  w ww. j  ava  2 s  .  co  m*/
 * See http://redis.io/commands/expireat
 * 
 * @param key key
 * @param unixTime unixTime
 * @return Boolean
 */
public Boolean expireAt(byte[] key, long unixTime) {
    return redisTemplate.execute(new RedisCallback<Boolean>() {
        @Override
        public Boolean doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.expireAt(key, unixTime);
        }
    });
}