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

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

Introduction

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

Prototype

void rename(byte[] sourceKey, byte[] targetKey);

Source Link

Document

Rename key sourceKey to targetKey .

Usage

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

/**
 * Rename key {@code oleName} to {@code newName}.
 * <p>/* w  w  w . j a  v  a 2s  .  co m*/
 * See http://redis.io/commands/rename
 * 
 * @param oldName oldName
 * @param newName newName
 */
public static void rename(byte[] oldName, byte[] newName) {
    redisTemplate.execute(new RedisCallback<Void>() {
        @Override
        public Void doInRedis(RedisConnection redis) throws DataAccessException {
            redis.rename(oldName, newName);
            return null;
        }
    });
}

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

/**
 * Rename key {@code oleName} to {@code newName}.
 * <p>//from   w  ww . ja va 2 s.c om
 * See http://redis.io/commands/rename
 * 
 * @param oldName oldName
 * @param newName newName
 */
public void rename(byte[] oldName, byte[] newName) {
    redisTemplate.execute(new RedisCallback<Void>() {
        @Override
        public Void doInRedis(RedisConnection redis) throws DataAccessException {
            redis.rename(oldName, newName);
            return null;
        }
    });
}