redis.embedded.util.JedisUtil Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of embedded-redis Show documentation
Show all versions of embedded-redis Show documentation
Redis embedded server for Java integration testing
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