Example usage for org.springframework.data.redis.connection.jedis JedisConnectionFactory JedisConnectionFactory

List of usage examples for org.springframework.data.redis.connection.jedis JedisConnectionFactory JedisConnectionFactory

Introduction

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

Prototype

public JedisConnectionFactory(RedisClusterConfiguration clusterConfig, JedisClientConfiguration clientConfig) 

Source Link

Document

Constructs a new JedisConnectionFactory instance using the given RedisClusterConfiguration and JedisClientConfiguration .

Usage

From source file:org.springframework.boot.autoconfigure.data.redis.JedisConnectionConfiguration.java

private JedisConnectionFactory createJedisConnectionFactory() {
    JedisClientConfiguration clientConfiguration = getJedisClientConfiguration();
    if (getSentinelConfig() != null) {
        return new JedisConnectionFactory(getSentinelConfig(), clientConfiguration);
    }/* w  w  w .  ja  v  a2  s. com*/
    if (getClusterConfiguration() != null) {
        return new JedisConnectionFactory(getClusterConfiguration(), clientConfiguration);
    }
    return new JedisConnectionFactory(getStandaloneConfig(), clientConfiguration);
}

From source file:org.springframework.data.redis.connection.jedis.JedisConnectionFactoryUnitTests.java

private JedisConnectionFactory initSpyedConnectionFactory(RedisSentinelConfiguration sentinelConfig,
        JedisPoolConfig poolConfig) {/*from   w  w  w.j  a v a 2s . c  o m*/

    // we have to use a spy here as jedis would start connecting to redis sentinels when the pool is created.
    JedisConnectionFactory factorySpy = spy(new JedisConnectionFactory(sentinelConfig, poolConfig));
    doReturn(null).when(factorySpy).createRedisSentinelPool(Matchers.any(RedisSentinelConfiguration.class));
    doReturn(null).when(factorySpy).createRedisPool();
    return factorySpy;
}