Java Code Examples for com.lambdaworks.redis.RedisClient#connect()

The following examples show how to use com.lambdaworks.redis.RedisClient#connect() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DoTestLettuceHookProxy.java    From uavstack with Apache License 2.0 5 votes vote down vote up
private static void testSync() {

        System.out.println("TEST Lettuce sync ======================================================");
        RedisClient redisClient = RedisClient.create("redis://localhost:6379/0");
        RedisConnection<String, String> conn = redisClient.connect();

        System.out.println("Connected to Redis");

        conn.set("foo", "bar");
        String value = conn.get("foo");
        System.out.println(value);

        conn.close();
        redisClient.shutdown();
    }
 
Example 2
Source File: RedisCacheTestMain.java    From registry with Apache License 2.0 5 votes vote down vote up
private static void setConnection() {
//        RedisClient redisClient = RedisClient.create(new RedisURI("127.0.0.1", 6379, 10L, TimeUnit.SECONDS));
        RedisClient redisClient = RedisClient.create("redis://127.0.0.1:6379");
//        RedisClient redisClient = RedisClient.create(new RedisURI.Builder.redis("127.0.0.1", 6379).build());
        connection = redisClient.connect();
        connection1 = redisClient.connect();
    }
 
Example 3
Source File: LettuceStore.java    From attic-apex-malhar with Apache License 2.0 5 votes vote down vote up
@Override
public void connect() throws IOException
{
  client = new RedisClient(host, port);
  connection = client.connect();
  connection.select(dbIndex);
}
 
Example 4
Source File: RedisCacheTestMain.java    From streamline with Apache License 2.0 5 votes vote down vote up
private static void setConnection() {
//        RedisClient redisClient = RedisClient.create(new RedisURI("127.0.0.1", 6379, 10L, TimeUnit.SECONDS));
        RedisClient redisClient = RedisClient.create("redis://127.0.0.1:6379");
//        RedisClient redisClient = RedisClient.create(new RedisURI.Builder.redis("127.0.0.1", 6379).build());
        connection = redisClient.connect();
        connection1 = redisClient.connect();
    }
 
Example 5
Source File: Lettuce3InstrumentationTest.java    From apm-agent-java with Apache License 2.0 4 votes vote down vote up
@Before
public void setUpLettuce() {
    client = new RedisClient("localhost", redisPort);
    connection = client.connect();
    reporter.disableDestinationAddressCheck();
}
 
Example 6
Source File: RedisAsyncCommanderProvider.java    From EasyTransaction with Apache License 2.0 4 votes vote down vote up
public RedisAsyncCommanderProvider(String uri){
	RedisClient client = RedisClient.create(uri);
	StatefulRedisConnection<String, byte[]> connect = client.connect(getCodec());
	cmd = connect.async();
}