Search in sources :

Example 1 with ClientResources

use of com.lambdaworks.redis.resource.ClientResources in project x-pipe by ctripcorp.

the class LuttuceJedisCompareTest method findRedisConnection.

private static RedisClient findRedisConnection(String host, int port) {
    ClientResources clientResources = // 
    DefaultClientResources.builder().reconnectDelay(// 
    Delay.constant(10, TimeUnit.SECONDS)).build();
    RedisURI redisUri = new RedisURI(host, port, 2, TimeUnit.SECONDS);
    ClientOptions clientOptions = // 
    ClientOptions.builder().disconnectedBehavior(// 
    DisconnectedBehavior.REJECT_COMMANDS).build();
    RedisClient redis = RedisClient.create(clientResources, redisUri);
    redis.setOptions(clientOptions);
    return redis;
}
Also used : RedisClient(com.lambdaworks.redis.RedisClient) ClientOptions(com.lambdaworks.redis.ClientOptions) ClientResources(com.lambdaworks.redis.resource.ClientResources) DefaultClientResources(com.lambdaworks.redis.resource.DefaultClientResources) RedisURI(com.lambdaworks.redis.RedisURI)

Aggregations

ClientOptions (com.lambdaworks.redis.ClientOptions)1 RedisClient (com.lambdaworks.redis.RedisClient)1 RedisURI (com.lambdaworks.redis.RedisURI)1 ClientResources (com.lambdaworks.redis.resource.ClientResources)1 DefaultClientResources (com.lambdaworks.redis.resource.DefaultClientResources)1