- Add asking to cluster commands - Make jedis cluster return connection to original pool - Add tests for MOVED and ASK cluster responses - Refactor connection handler to recalculate connections based on slots This commit makes the first usable version of Jedis along with Redis Cluster
21 lines
406 B
Java
21 lines
406 B
Java
package redis.clients.jedis;
|
|
|
|
import java.util.Set;
|
|
|
|
public class JedisRandomConnectionHandler extends JedisClusterConnectionHandler {
|
|
|
|
|
|
public JedisRandomConnectionHandler(Set<HostAndPort> nodes) {
|
|
super(nodes);
|
|
}
|
|
|
|
public Jedis getConnection() {
|
|
return getRandomConnection().getResource();
|
|
}
|
|
|
|
@Override
|
|
Jedis getConnectionFromSlot(int slot) {
|
|
return getRandomConnection().getResource();
|
|
}
|
|
}
|