All Downloads are FREE. Search and download functionalities are using the official Maven repository.

redis.embedded.util.JedisUtil Maven / Gradle / Ivy

There is a newer version: 0.11.0
Show newest version
package redis.embedded.util;

import redis.embedded.Redis;
import redis.embedded.RedisCluster;

import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

/**
 * Created by piotrturek on 01/02/15.
 */
public class JedisUtil {
    public static Set jedisHosts(Redis redis) {
        final List ports = redis.ports();
        return portsToJedisHosts(ports);
    }

    public static Set sentinelHosts(RedisCluster cluster) {
        final List ports = cluster.sentinelPorts();
        return portsToJedisHosts(ports);
    }

    public static Set portsToJedisHosts(List ports) {
        return ports.stream().map(p -> "localhost:" + p).collect(Collectors.toSet());
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy