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

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

Introduction

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

Prototype

void slaveOf(String host, int port);

Source Link

Document

Change redis replication setting to new master.

Usage

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

/**
 * Change redis replication setting to new master.
 * <p>//www . j a va  2 s.  co m
 * See http://redis.io/commands/slaveof
 * 
 * @param host host
 * @param port port
 * @since 1.3
 */
public static void slaveOf(String host, int port) {
    redisTemplate.execute(new RedisCallback<Void>() {
        @Override
        public Void doInRedis(RedisConnection redis) throws DataAccessException {
            redis.slaveOf(host, port);
            return null;
        }
    });
}

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

/**
 * Change redis replication setting to new master.
 * <p>/* w w w .  ja v  a 2 s  . co m*/
 * See http://redis.io/commands/slaveof
 * 
 * @param host host
 * @param port port
 * @since 1.3
 */
public void slaveOf(String host, int port) {
    redisTemplate.execute(new RedisCallback<Void>() {
        @Override
        public Void doInRedis(RedisConnection redis) throws DataAccessException {
            redis.slaveOf(host, port);
            return null;
        }
    });
}