Example usage for org.springframework.data.redis.connection.lettuce LettuceConnection CODEC

List of usage examples for org.springframework.data.redis.connection.lettuce LettuceConnection CODEC

Introduction

In this page you can find the example usage for org.springframework.data.redis.connection.lettuce LettuceConnection CODEC.

Prototype

RedisCodec CODEC

To view the source code for org.springframework.data.redis.connection.lettuce LettuceConnection CODEC.

Click Source Link

Usage

From source file:org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory.java

protected RedisAsyncConnection<byte[], byte[]> createLettuceConnector() {
    try {/*from   w  w  w  .  j  av a2s  .c  o m*/

        RedisAsyncConnection connection = null;
        if (client instanceof RedisClient) {
            connection = ((RedisClient) client).connectAsync(LettuceConnection.CODEC);
            if (dbIndex > 0) {
                connection.select(dbIndex);
            }
        } else {
            connection = (RedisAsyncConnection<byte[], byte[]>) ((RedisClusterClient) client)
                    .connectClusterAsync(LettuceConnection.CODEC);
        }
        return connection;
    } catch (RedisException e) {
        throw new RedisConnectionFailureException(
                "Unable to connect to Redis on " + getHostName() + ":" + getPort(), e);
    }
}