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

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

Introduction

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

Prototype

default void restore(byte[] key, long ttlInMillis, byte[] serializedValue) 

Source Link

Document

Create key using the serializedValue , previously obtained using #dump(byte[]) .

Usage

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

/**
 * Create {@code key} using the {@code serializedValue}, previously obtained using {@link #dump(byte[])}.
 * <p>//w w  w  .j av  a 2 s .  c o m
 * See http://redis.io/commands/restore
 * 
 * @param key key
 * @param ttlInMillis ttlInMillis
 * @param serializedValue serializedValue
 */
public static void restore(byte[] key, long ttlInMillis, byte[] serializedValue) {
    redisTemplate.execute(new RedisCallback<Void>() {
        @Override
        public Void doInRedis(RedisConnection redis) throws DataAccessException {
            redis.restore(key, ttlInMillis, serializedValue);
            return null;
        }
    });
}

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

/**
 * Create {@code key} using the {@code serializedValue}, previously obtained using {@link #dump(byte[])}.
 * <p>/*from   w  w w. j av  a 2  s  . c  om*/
 * See http://redis.io/commands/restore
 * 
 * @param key key
 * @param ttlInMillis ttlInMillis
 * @param serializedValue serializedValue
 */
public void restore(byte[] key, long ttlInMillis, byte[] serializedValue) {
    redisTemplate.execute(new RedisCallback<Void>() {
        @Override
        public Void doInRedis(RedisConnection redis) throws DataAccessException {
            redis.restore(key, ttlInMillis, serializedValue);
            return null;
        }
    });
}