Search in sources :

Example 1 with RedisURI

use of com.lambdaworks.redis.RedisURI in project jetcache by alibaba.

the class RedisLutteceCacheTest method testCluster.

@Test
public void testCluster() throws Exception {
    if (!checkOS()) {
        return;
    }
    RedisURI node1 = RedisURI.create("127.0.0.1", 7000);
    RedisURI node2 = RedisURI.create("127.0.0.1", 7001);
    RedisURI node3 = RedisURI.create("127.0.0.1", 7002);
    RedisClusterClient client = RedisClusterClient.create(Arrays.asList(node1, node2, node3));
    test(client);
}
Also used : RedisURI(com.lambdaworks.redis.RedisURI) RedisClusterClient(com.lambdaworks.redis.cluster.RedisClusterClient) RefreshCacheTest(com.alicp.jetcache.RefreshCacheTest) Test(org.junit.Test) LoadingCacheTest(com.alicp.jetcache.LoadingCacheTest) AbstractExternalCacheTest(com.alicp.jetcache.test.external.AbstractExternalCacheTest)

Example 2 with RedisURI

use of com.lambdaworks.redis.RedisURI in project jetcache by alibaba.

the class LutteceConnectionManagerTest method testCluster.

@Test
public void testCluster() {
    if (!RedisLutteceCacheTest.checkOS()) {
        return;
    }
    RedisURI node1 = RedisURI.create("127.0.0.1", 7000);
    RedisURI node2 = RedisURI.create("127.0.0.1", 7001);
    RedisURI node3 = RedisURI.create("127.0.0.1", 7002);
    RedisClusterClient client = RedisClusterClient.create(Arrays.asList(node1, node2, node3));
    LutteceConnectionManager m = LutteceConnectionManager.defaultManager();
    Assert.assertSame(m.commands(client), m.commands(client));
    Assert.assertSame(m.asyncCommands(client), m.asyncCommands(client));
    Assert.assertSame(m.reactiveCommands(client), m.reactiveCommands(client));
    m.removeAndClose(client);
}
Also used : RedisURI(com.lambdaworks.redis.RedisURI) RedisClusterClient(com.lambdaworks.redis.cluster.RedisClusterClient) Test(org.junit.Test)

Example 3 with RedisURI

use of com.lambdaworks.redis.RedisURI in project jetcache by alibaba.

the class RedisLutteceCacheTest method testSentinel.

@Test
public void testSentinel() throws Exception {
    RedisURI redisUri = RedisURI.Builder.sentinel("127.0.0.1", 26379, "mymaster").withSentinel("127.0.0.1", 26380).withSentinel("127.0.0.1", 26381).build();
    RedisClient client = RedisClient.create(redisUri);
    test(client);
}
Also used : AbstractRedisClient(com.lambdaworks.redis.AbstractRedisClient) RedisClient(com.lambdaworks.redis.RedisClient) RedisURI(com.lambdaworks.redis.RedisURI) RefreshCacheTest(com.alicp.jetcache.RefreshCacheTest) Test(org.junit.Test) LoadingCacheTest(com.alicp.jetcache.LoadingCacheTest) AbstractExternalCacheTest(com.alicp.jetcache.test.external.AbstractExternalCacheTest)

Aggregations

RedisURI (com.lambdaworks.redis.RedisURI)3 Test (org.junit.Test)3 LoadingCacheTest (com.alicp.jetcache.LoadingCacheTest)2 RefreshCacheTest (com.alicp.jetcache.RefreshCacheTest)2 AbstractExternalCacheTest (com.alicp.jetcache.test.external.AbstractExternalCacheTest)2 RedisClusterClient (com.lambdaworks.redis.cluster.RedisClusterClient)2 AbstractRedisClient (com.lambdaworks.redis.AbstractRedisClient)1 RedisClient (com.lambdaworks.redis.RedisClient)1