|
8 | 8 | import org.apache.commons.pool2.impl.GenericObjectPoolConfig;
|
9 | 9 |
|
10 | 10 | import redis.clients.jedis.annots.Experimental;
|
| 11 | +import redis.clients.jedis.builders.ClusterClientBuilder; |
11 | 12 | import redis.clients.jedis.executors.ClusterCommandExecutor;
|
| 13 | +import redis.clients.jedis.executors.CommandExecutor; |
12 | 14 | import redis.clients.jedis.providers.ClusterConnectionProvider;
|
13 | 15 | import redis.clients.jedis.csc.Cache;
|
14 | 16 | import redis.clients.jedis.csc.CacheConfig;
|
15 | 17 | import redis.clients.jedis.csc.CacheFactory;
|
| 18 | +import redis.clients.jedis.providers.ConnectionProvider; |
16 | 19 | import redis.clients.jedis.util.JedisClusterCRC16;
|
17 | 20 |
|
18 | 21 | public class JedisCluster extends UnifiedJedis {
|
@@ -334,6 +337,33 @@ private JedisCluster(ClusterConnectionProvider provider, int maxAttempts, Durati
|
334 | 337 | super(provider, maxAttempts, maxTotalRetriesDuration, protocol, clientSideCache);
|
335 | 338 | }
|
336 | 339 |
|
| 340 | + private JedisCluster(CommandExecutor commandExecutor, ConnectionProvider connectionProvider, CommandObjects commandObjects, RedisProtocol redisProtocol, Cache cache) { |
| 341 | + super(commandExecutor, connectionProvider, commandObjects, redisProtocol, cache); |
| 342 | + } |
| 343 | + |
| 344 | + /** |
| 345 | + * Fluent builder for {@link JedisCluster} (Redis Cluster). |
| 346 | + * <p> |
| 347 | + * Obtain an instance via {@link #builder()}. |
| 348 | + * </p> |
| 349 | + */ |
| 350 | + static public class Builder extends ClusterClientBuilder<JedisCluster> { |
| 351 | + |
| 352 | + @Override |
| 353 | + protected JedisCluster createClient() { |
| 354 | + return new JedisCluster(commandExecutor, connectionProvider, commandObjects, clientConfig.getRedisProtocol(), |
| 355 | + cache); |
| 356 | + } |
| 357 | + } |
| 358 | + |
| 359 | + /** |
| 360 | + * Create a new builder for configuring JedisCluster instances. |
| 361 | + * @return a new {@link JedisCluster.Builder} instance |
| 362 | + */ |
| 363 | + public static Builder builder() { |
| 364 | + return new Builder(); |
| 365 | + } |
| 366 | + |
337 | 367 | /**
|
338 | 368 | * Returns all nodes that were configured to connect to in key-value pairs ({@link Map}).<br>
|
339 | 369 | * Key is the HOST:PORT and the value is the connection pool.
|
|
0 commit comments