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

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

Introduction

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

Prototype

@Nullable
byte[] echo(byte[] message);

Source Link

Document

Returns message via server roundtrip.

Usage

From source file:com.gopivotal.cloudfoundry.test.core.RedisUtils.java

public String checkAccess(RedisConnectionFactory redisConnectionFactory) {
    RedisConnection connection = null;
    try {//  w ww.  j  a v a 2 s. c  om
        connection = redisConnectionFactory.getConnection();
        connection.echo("hello".getBytes());
        return "ok";
    } catch (Exception e) {
        return "failed with " + e.getMessage();
    } finally {
        try {
            if (connection != null) {
                connection.close();
            }
        } catch (Exception e) {
            return "Redis connection close failed with " + e.getMessage();
        }
    }
}

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

/**
 * Returns {@code message} via server roundtrip.
 * <p>//  w w  w  .  j  a va  2  s.  c o  m
 * 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

/**
 * Returns {@code message} via server roundtrip.
 * <p>//  ww  w.  jav a2 s . c o  m
 * 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);
        }
    });
}