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

/**
 * Load configuration parameters for given {@code pattern} from server.
 * <p>//from  ww w  .  j  ava2s .co m
 * See http://redis.io/commands/config-get
 * 
 * @param pattern pattern
 * @return List<String>
 */
public List<String> getConfig(String pattern) {
    return redisTemplate.execute(new RedisCallback<List<String>>() {
        @Override
        public List<String> doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.getConfig(pattern);
        }
    });
}

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

/**
 * Load configuration parameters for given {@code pattern} from server.
 * <p>/*from   ww  w. j  av  a2s  . c o  m*/
 * See http://redis.io/commands/config-get
 * 
 * @param pattern pattern
 * @return List<String>
 */
public static List<String> getConfig(String pattern) {
    return redisTemplate.execute(new RedisCallback<List<String>>() {
        @Override
        public List<String> doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.getConfig(pattern);
        }
    });
}

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

/**
 * Set server configuration for {@code param} to {@code value}.
 * <p>/* w  ww  .java  2  s  . co  m*/
 * See http://redis.io/commands/config-set
 * 
 * @param param param
 * @param value value
 */
public void setConfig(String param, String value) {
    redisTemplate.execute(new RedisCallback<Void>() {
        @Override
        public Void doInRedis(RedisConnection redis) throws DataAccessException {
            redis.setConfig(param, value);
            return null;
        }
    });
}

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

/**
 * Set server configuration for {@code param} to {@code value}.
 * <p>/*from w  w  w.  j a v  a 2s  .  c  o m*/
 * See http://redis.io/commands/config-set
 * 
 * @param param param
 * @param value value
 */
public static void setConfig(String param, String value) {
    redisTemplate.execute(new RedisCallback<Void>() {
        @Override
        public Void doInRedis(RedisConnection redis) throws DataAccessException {
            redis.setConfig(param, value);
            return null;
        }
    });
}

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

/**
 * Reset statistic counters on server. <br>
 * Counters can be retrieved using {@link #info()}.
 * <p>/*from w  w  w.  j a  v  a2s .c om*/
 * See http://redis.io/commands/config-resetstat
 */
public void resetConfigStats() {
    redisTemplate.execute(new RedisCallback<Void>() {
        @Override
        public Void doInRedis(RedisConnection redis) throws DataAccessException {
            redis.resetConfigStats();
            return null;
        }
    });
}

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

/**
 * Reset statistic counters on server. <br>
 * Counters can be retrieved using {@link #info()}.
 * <p>//from w  ww. ja v a2 s  .  c  om
 * See http://redis.io/commands/config-resetstat
 */
public static void resetConfigStats() {
    redisTemplate.execute(new RedisCallback<Void>() {
        @Override
        public Void doInRedis(RedisConnection redis) throws DataAccessException {
            redis.resetConfigStats();
            return null;
        }
    });
}

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

/**
 * Request server timestamp using {@code TIME} command.
 * //from  w w  w. jav  a  2s . com
 * @return current server time in milliseconds.
 * @since 1.1
 */
public Long time() {
    return redisTemplate.execute(new RedisCallback<Long>() {
        @Override
        public Long doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.time();
        }
    });
}

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

/**
 * Request server timestamp using {@code TIME} command.
 * /*from w  w  w.  j  a va2 s.  co m*/
 * @return current server time in milliseconds.
 * @since 1.1
 */
public static Long time() {
    return redisTemplate.execute(new RedisCallback<Long>() {
        @Override
        public Long doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.time();
        }
    });
}

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

/**
 * Closes a given client connection identified by {@literal host:port}.
 * //from   w w w. j a  v a  2  s .c o m
 * @param host of connection to close.
 * @param port of connection to close
 * @since 1.3
 */
public void killClient(String host, int port) {
    redisTemplate.execute(new RedisCallback<Void>() {
        @Override
        public Void doInRedis(RedisConnection redis) throws DataAccessException {
            redis.killClient(host, port);
            return null;
        }
    });
}

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

/**
 * Closes a given client connection identified by {@literal host:port}.
 * //from   w  w w .j a  va2  s  .co m
 * @param host of connection to close.
 * @param port of connection to close
 * @since 1.3
 */
public static void killClient(String host, int port) {
    redisTemplate.execute(new RedisCallback<Void>() {
        @Override
        public Void doInRedis(RedisConnection redis) throws DataAccessException {
            redis.killClient(host, port);
            return null;
        }
    });
}