-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support jedis cluster pipeline on 4.3.2
- Loading branch information
Showing
4 changed files
with
40 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
...he-support/jetcache-redis/src/main/java/com/alicp/jetcache/redis/JedisClusterWrapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.alicp.jetcache.redis; | ||
|
||
import org.apache.commons.pool2.impl.GenericObjectPoolConfig; | ||
import redis.clients.jedis.ClusterPipeline; | ||
import redis.clients.jedis.DefaultJedisClientConfig; | ||
import redis.clients.jedis.HostAndPort; | ||
import redis.clients.jedis.JedisCluster; | ||
import redis.clients.jedis.providers.ClusterConnectionProvider; | ||
|
||
import java.util.Set; | ||
|
||
/** | ||
* Support for pipeline in JedisCluster. | ||
*/ | ||
public class JedisClusterWrapper extends JedisCluster { | ||
|
||
private final ClusterConnectionProvider provider; | ||
|
||
public JedisClusterWrapper(Set<HostAndPort> hostAndPortSet, int connectionTimeout, int soTimeout, int maxAttempt, String user, String password, String clientName, GenericObjectPoolConfig poolConfig, boolean ssl) { | ||
super(hostAndPortSet, connectionTimeout, soTimeout, maxAttempt, user, password, clientName, poolConfig, ssl); | ||
DefaultJedisClientConfig jedisClientConfig = DefaultJedisClientConfig.builder().connectionTimeoutMillis(connectionTimeout) | ||
.socketTimeoutMillis(soTimeout).user(user).password(password).clientName(clientName).ssl(ssl).build(); | ||
this.provider = new ClusterConnectionProvider(hostAndPortSet, jedisClientConfig, poolConfig); | ||
} | ||
|
||
public ClusterPipeline getPipeline() { | ||
return new ClusterPipeline(provider); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters