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.RedisUtils.java

/**
 * Select the DB with given positive {@code dbIndex}.
 * <p>//from  w w  w.j a v  a2 s .c om
 * See http://redis.io/commands/select
 * 
 * @param dbIndex dbIndex
 */
public static void select(int dbIndex) {
    redisTemplate.execute(new RedisCallback<Void>() {
        @Override
        public Void doInRedis(RedisConnection redis) throws DataAccessException {
            redis.select(dbIndex);
            return null;
        }
    });
}

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

/**
 * Select the DB with given positive {@code dbIndex}.
 * <p>/*w w w  .  j  av a 2  s .  c o m*/
 * See http://redis.io/commands/select
 * 
 * @param dbIndex dbIndex
 */
public void select(int dbIndex) {
    redisTemplate.execute(new RedisCallback<Void>() {
        @Override
        public Void doInRedis(RedisConnection redis) throws DataAccessException {
            redis.select(dbIndex);
            return null;
        }
    });
}

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

/**
 * Returns {@code message} via server roundtrip.
 * <p>//from  ww w  . j  av  a2  s  .c om
 * See http://redis.io/commands/echo
 * 
 * @param message message
 * @return byte[]
 */
public byte[] echo(byte[] message) {
    return redisTemplate.execute(new RedisCallback<byte[]>() {
        @Override
        public byte[] doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.echo(message);
        }
    });
}

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

/**
 * Returns {@code message} via server roundtrip.
 * <p>/* w w w  .j ava 2s .com*/
 * See http://redis.io/commands/echo
 * 
 * @param message message
 * @return byte[]
 */
public static byte[] echo(byte[] message) {
    return redisTemplate.execute(new RedisCallback<byte[]>() {
        @Override
        public byte[] doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.echo(message);
        }
    });
}

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

/**
 * Test connection.//w w w.  j  a  v a 2  s . c  o  m
 * <p>
 * See http://redis.io/commands/ping
 * 
 * @return Server response message - usually {@literal PONG}.
 */
public String ping() {
    return redisTemplate.execute(new RedisCallback<String>() {
        @Override
        public String doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.ping();
        }
    });
}

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

/**
 * Test connection./*from  w  ww  . j a v a  2s  .  com*/
 * <p>
 * See http://redis.io/commands/ping
 * 
 * @return Server response message - usually {@literal PONG}.
 */
public static String ping() {
    return redisTemplate.execute(new RedisCallback<String>() {
        @Override
        public String doInRedis(RedisConnection redis) throws DataAccessException {
            return redis.ping();
        }
    });
}

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

/**
 * Start an {@literal Append Only File} rewrite process on server.
 * <p>//from  www.j  av  a2s . com
 * See http://redis.io/commands/bgrewriteaof
 * 
 * @deprecated As of 1.3, use {@link #bgReWriteAof}.
 */
@Deprecated
public void bgWriteAof() {
    redisTemplate.execute(new RedisCallback<Void>() {
        @Override
        public Void doInRedis(RedisConnection redis) throws DataAccessException {
            redis.bgWriteAof();
            return null;
        }
    });
}

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

/**
 * Start an {@literal Append Only File} rewrite process on server.
 * <p>/*from w w  w  . java2 s  . co  m*/
 * See http://redis.io/commands/bgrewriteaof
 * 
 * @deprecated As of 1.3, use {@link #bgReWriteAof}.
 */
@Deprecated
public static void bgWriteAof() {
    redisTemplate.execute(new RedisCallback<Void>() {
        @Override
        public Void doInRedis(RedisConnection redis) throws DataAccessException {
            redis.bgWriteAof();
            return null;
        }
    });
}

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

/**
 * Start an {@literal Append Only File} rewrite process on server.
 * <p>/*  w w w.j  a va2s.co  m*/
 * See http://redis.io/commands/bgrewriteaof
 * 
 * @since 1.3
 */
public void bgReWriteAof() {
    redisTemplate.execute(new RedisCallback<Void>() {
        @Override
        public Void doInRedis(RedisConnection redis) throws DataAccessException {
            redis.bgReWriteAof();
            return null;
        }
    });
}

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

/**
 * Start an {@literal Append Only File} rewrite process on server.
 * <p>//from  w w w .jav a2s  .  c  o  m
 * See http://redis.io/commands/bgrewriteaof
 * 
 * @since 1.3
 */
public static void bgReWriteAof() {
    redisTemplate.execute(new RedisCallback<Void>() {
        @Override
        public Void doInRedis(RedisConnection redis) throws DataAccessException {
            redis.bgReWriteAof();
            return null;
        }
    });
}