Java Code Examples for org.redisson.client.RedisClient#create()

The following examples show how to use org.redisson.client.RedisClient#create() . 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: RedisRunner.java    From redisson with Apache License 2.0 5 votes vote down vote up
public RedisClient createRedisClientInstance() {
    if (redisProcess.isAlive()) {
        RedisClientConfig config = new RedisClientConfig();
                config.setAddress(runner.getInitialBindAddr(), runner.getPort());
        return RedisClient.create(config);
    }
    throw new IllegalStateException("Redis server instance is not running.");
}
 
Example 2
Source File: RedisRunner.java    From redisson with Apache License 2.0 5 votes vote down vote up
public RedisClient createRedisClientInstance() {
    if (redisProcess.isAlive()) {
        RedisClientConfig config = new RedisClientConfig();
                config.setAddress(runner.getInitialBindAddr(), runner.getPort());
        return RedisClient.create(config);
    }
    throw new IllegalStateException("Redis server instance is not running.");
}
 
Example 3
Source File: RedisRunner.java    From redisson with Apache License 2.0 5 votes vote down vote up
public RedisClient createRedisClientInstance() {
    if (redisProcess.isAlive()) {
        RedisClientConfig config = new RedisClientConfig();
                config.setAddress(runner.getInitialBindAddr(), runner.getPort());
        return RedisClient.create(config);
    }
    throw new IllegalStateException("Redis server instance is not running.");
}
 
Example 4
Source File: RedisRunner.java    From redisson with Apache License 2.0 5 votes vote down vote up
public RedisClient createRedisClientInstance() {
    if (redisProcess.isAlive()) {
        RedisClientConfig config = new RedisClientConfig();
                config.setAddress(runner.getInitialBindAddr(), runner.getPort());
        return RedisClient.create(config);
    }
    throw new IllegalStateException("Redis server instance is not running.");
}
 
Example 5
Source File: RedisRunner.java    From redisson with Apache License 2.0 5 votes vote down vote up
public RedisClient createRedisClientInstance() {
    if (redisProcess.isAlive()) {
        RedisClientConfig config = new RedisClientConfig();
                config.setAddress(runner.getInitialBindAddr(), runner.getPort());
        return RedisClient.create(config);
    }
    throw new IllegalStateException("Redis server instance is not running.");
}
 
Example 6
Source File: RedisRunner.java    From redisson with Apache License 2.0 5 votes vote down vote up
public RedisClient createRedisClientInstance() {
    if (redisProcess.isAlive()) {
        RedisClientConfig config = new RedisClientConfig();
                config.setAddress(runner.getInitialBindAddr(), runner.getPort());
        return RedisClient.create(config);
    }
    throw new IllegalStateException("Redis server instance is not running.");
}
 
Example 7
Source File: RedisRunner.java    From redisson with Apache License 2.0 5 votes vote down vote up
public RedisClient createRedisClientInstance() {
    if (redisProcess.isAlive()) {
        RedisClientConfig config = new RedisClientConfig();
                config.setAddress(runner.getInitialBindAddr(), runner.getPort());
        return RedisClient.create(config);
    }
    throw new IllegalStateException("Redis server instance is not running.");
}
 
Example 8
Source File: RedisRunner.java    From redisson with Apache License 2.0 5 votes vote down vote up
public RedisClient createRedisClientInstance() {
    if (redisProcess.isAlive()) {
        RedisClientConfig config = new RedisClientConfig();
                config.setAddress(runner.getInitialBindAddr(), runner.getPort());
        return RedisClient.create(config);
    }
    throw new IllegalStateException("Redis server instance is not running.");
}
 
Example 9
Source File: RedissonTopicTest.java    From redisson with Apache License 2.0 5 votes vote down vote up
private RedisClient connect(ClusterProcesses processes, RedisRunner runner) {
    return RedisClient.create(new RedisClientConfig()
            .setAddress(processes.getNodes().stream()
                    .filter(node -> node.getRedisServerPort() == runner.getPort())
                    .findFirst()
                    .map(RedisProcess::getRedisServerAddressAndPort)
                    .orElseThrow(() -> new IllegalArgumentException(
                            "Failed to find node running at port: " + runner.getPort()
                                    + " in cluster processes"))));
}
 
Example 10
Source File: RedisClientTest.java    From redisson with Apache License 2.0 5 votes vote down vote up
@Before
public void before() throws IOException, InterruptedException {
    if (RedissonRuntimeEnvironment.isTravis) {
        RedisRunner.startDefaultRedisServerInstance();
    }
    RedisClientConfig config = new RedisClientConfig();
    config.setAddress(RedisRunner.getDefaultRedisServerBindAddressAndPort());
    redisClient = RedisClient.create(config);
}
 
Example 11
Source File: RedissonIntegrationTest.java    From tutorials with MIT License 5 votes vote down vote up
@Test
public void givenLowLevelRedisCommands_thenExecuteLowLevelCommandsOnRedis(){
    RedisClientConfig redisClientConfig = new RedisClientConfig();
    redisClientConfig.setAddress("localhost", 6379);
    RedisClient client = RedisClient.create(redisClientConfig);
    RedisConnection conn = client.connect();
    conn.sync(StringCodec.INSTANCE, RedisCommands.SET, "test", 0);

    String testValue = conn.sync(StringCodec.INSTANCE, RedisCommands.GET, "test");

    conn.closeAsync();
    client.shutdown();

    assertTrue(testValue.equals("0"));
}
 
Example 12
Source File: MasterSlaveConnectionManager.java    From redisson with Apache License 2.0 4 votes vote down vote up
@Override
public RedisClient createClient(NodeType type, RedisURI address, int timeout, int commandTimeout, String sslHostname) {
    RedisClientConfig redisConfig = createRedisConfig(type, address, timeout, commandTimeout, sslHostname);
    return RedisClient.create(redisConfig);
}
 
Example 13
Source File: MasterSlaveConnectionManager.java    From redisson with Apache License 2.0 4 votes vote down vote up
private RedisClient createClient(NodeType type, InetSocketAddress address, RedisURI uri, int timeout, int commandTimeout, String sslHostname) {
    RedisClientConfig redisConfig = createRedisConfig(type, null, timeout, commandTimeout, sslHostname);
    redisConfig.setAddress(address, uri);
    return RedisClient.create(redisConfig);
}