Example usage for org.springframework.data.redis.core RedisCallback RedisCallback

List of usage examples for org.springframework.data.redis.core RedisCallback RedisCallback

Introduction

In this page you can find the example usage for org.springframework.data.redis.core RedisCallback RedisCallback.

Prototype

RedisCallback

Source Link

Usage

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

/**
 * Assign given name to current connection.
 * //from   w  w  w .j  av  a  2  s .c o  m
 * @param name name
 * @since 1.3
 */
public void setClientName(byte[] name) {
    redisTemplate.execute(new RedisCallback<Void>() {
        @Override
        public Void doInRedis(RedisConnection redis) throws DataAccessException {
            redis.setClientName(name);
            return null;
        }
    });
}

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

/**
 * Assign given name to current connection.
 * //from   w w  w  . j  av  a 2  s.  c  o  m
 * @param name name
 * @since 1.3
 */
public static void setClientName(byte[] name) {
    redisTemplate.execute(new RedisCallback<Void>() {
        @Override
        public Void doInRedis(RedisConnection redis) throws DataAccessException {
            redis.setClientName(name);
            return null;
        }
    });
}

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

/**
 * Returns the name of the current connection.
 * <p>/* w w w  .  ja v a  2s .  co  m*/
 * See http://redis.io/commands/client-getname
 * 
 * @return String
 * @since 1.3
 */
public String getClientName() {
    return redisTemplate.execute(new RedisCallback<String>() {
        @Override
        public String doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.getClientName();
        }
    });
}

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

/**
 * Returns the name of the current connection.
 * <p>/* w w  w.j  a va 2s.c o m*/
 * See http://redis.io/commands/client-getname
 * 
 * @return String
 * @since 1.3
 */
public static String getClientName() {
    return redisTemplate.execute(new RedisCallback<String>() {
        @Override
        public String doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.getClientName();
        }
    });
}

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

/**
 * Request information and statistics about connected clients.
 * <p>//ww w.ja  v a  2s . c  o m
 * See http://redis.io/commands/client-list
 * 
 * @return {@link List} of {@link RedisClientInfo} objects.
 * @since 1.3
 */
public List<RedisClientInfo> getClientList() {
    return redisTemplate.execute(new RedisCallback<List<RedisClientInfo>>() {
        @Override
        public List<RedisClientInfo> doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.getClientList();
        }
    });
}

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

/**
 * Request information and statistics about connected clients.
 * <p>//ww w .ja va2s  .c o m
 * See http://redis.io/commands/client-list
 * 
 * @return {@link List} of {@link RedisClientInfo} objects.
 * @since 1.3
 */
public static List<RedisClientInfo> getClientList() {
    return redisTemplate.execute(new RedisCallback<List<RedisClientInfo>>() {
        @Override
        public List<RedisClientInfo> doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.getClientList();
        }
    });
}

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

/**
 * Change redis replication setting to new master.
 * <p>//from   w w  w . ja  v a2 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;
        }
    });
}

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

/**
 * Change redis replication setting to new master.
 * <p>/*w ww .  j  ava  2 s . c  o 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 server into master./*from  www . jav a 2s  .co m*/
 * <p>
 * See http://redis.io/commands/slaveof
 * 
 * @since 1.3
 */
public void slaveOfNoOne() {
    redisTemplate.execute(new RedisCallback<Void>() {
        @Override
        public Void doInRedis(RedisConnection redis) throws DataAccessException {
            redis.slaveOfNoOne();
            return null;
        }
    });
}

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

/**
 * Change server into master./*from  ww w  .  j  a  v a2 s .c  om*/
 * <p>
 * See http://redis.io/commands/slaveof
 * 
 * @since 1.3
 */
public static void slaveOfNoOne() {
    redisTemplate.execute(new RedisCallback<Void>() {
        @Override
        public Void doInRedis(RedisConnection redis) throws DataAccessException {
            redis.slaveOfNoOne();
            return null;
        }
    });
}