From ef483240d4020772dedac6681a7bf871ad65e9b1 Mon Sep 17 00:00:00 2001 From: Josh Rotenberg Date: Mon, 28 Apr 2025 15:54:48 -0700 Subject: [PATCH 1/3] docs: update UnifiedJedis class and constructor documentation --- .../redis/clients/jedis/UnifiedJedis.java | 217 +++++++++++++++++- 1 file changed, 211 insertions(+), 6 deletions(-) diff --git a/src/main/java/redis/clients/jedis/UnifiedJedis.java b/src/main/java/redis/clients/jedis/UnifiedJedis.java index 4b2e38faac..fb75712e6d 100644 --- a/src/main/java/redis/clients/jedis/UnifiedJedis.java +++ b/src/main/java/redis/clients/jedis/UnifiedJedis.java @@ -45,6 +45,52 @@ import redis.clients.jedis.util.JedisURIHelper; import redis.clients.jedis.util.KeyValue; +/** + * UnifiedJedis provides a single interface for multiple Redis deployment types. + * Supports standalone Redis servers, Redis Sentinel, Redis Cluster, and sharded Redis deployments. + * Implements multiple command interfaces for Redis operations. + * + *

Features: + *

+ * + *

Basic usage with default connection (localhost:6379): + *

+ * UnifiedJedis jedis = new UnifiedJedis();
+ * jedis.set("key", "value");
+ * String value = jedis.get("key");
+ * jedis.close();
+ * 
+ * + *

Usage with specific host and port: + *

+ * UnifiedJedis jedis = new UnifiedJedis(new HostAndPort("localhost", 6379));
+ * jedis.set("key", "value");
+ * String value = jedis.get("key");
+ * jedis.close();
+ * 
+ * + *

Usage with URI (including authentication): + *

+ * UnifiedJedis jedis = new UnifiedJedis(URI.create("redis://user:password@localhost:6379/0"));
+ * jedis.set("key", "value");
+ * String value = jedis.get("key");
+ * jedis.close();
+ * 
+ * + *

Production usage requires configuration of connection timeouts and connection pooling. + * + * @see JedisPool For connection pooling with standalone Redis servers + * @see JedisCluster For dedicated Redis Cluster support + * @see JedisSentineled For dedicated Redis Sentinel support + * @see JedisSentinelPool For Redis Sentinel connection pooling + */ public class UnifiedJedis implements JedisCommands, JedisBinaryCommands, SampleKeyedCommands, SampleBinaryKeyedCommands, RedisModuleCommands, AutoCloseable { @@ -57,18 +103,37 @@ public class UnifiedJedis implements JedisCommands, JedisBinaryCommands, private JedisBroadcastAndRoundRobinConfig broadcastAndRoundRobinConfig = null; private final Cache cache; + /** + * Creates a UnifiedJedis instance with default host and port (localhost:6379). + */ public UnifiedJedis() { this(new HostAndPort(Protocol.DEFAULT_HOST, Protocol.DEFAULT_PORT)); } + /** + * Creates a UnifiedJedis instance with the specified host and port. + * + * @param hostAndPort The host and port of the Redis server + */ public UnifiedJedis(HostAndPort hostAndPort) { this(new PooledConnectionProvider(hostAndPort), (RedisProtocol) null); } + /** + * Creates a UnifiedJedis instance with the specified URL. + * + * @param url The URL of the Redis server (e.g., "redis://localhost:6379") + */ public UnifiedJedis(final String url) { this(URI.create(url)); } + /** + * Creates a UnifiedJedis instance with the specified URI. + * The URI can include authentication information, database index, and SSL configuration. + * + * @param uri The URI of the Redis server (e.g., "redis://user:password@localhost:6379/1") + */ public UnifiedJedis(final URI uri) { this(JedisURIHelper.getHostAndPort(uri), DefaultJedisClientConfig.builder() .user(JedisURIHelper.getUser(uri)).password(JedisURIHelper.getPassword(uri)) @@ -100,28 +165,69 @@ public UnifiedJedis(final URI uri, JedisClientConfig config) { .sslParameters(config.getSslParameters()).hostnameVerifier(config.getHostnameVerifier()).build()); } + /** + * Creates a UnifiedJedis instance with the specified host, port, and client configuration. + * + * @param hostAndPort The host and port of the Redis server + * @param clientConfig The client configuration + */ public UnifiedJedis(HostAndPort hostAndPort, JedisClientConfig clientConfig) { this(new PooledConnectionProvider(hostAndPort, clientConfig), clientConfig.getRedisProtocol()); } + /** + * Creates a UnifiedJedis instance with the specified host, port, client configuration, and cache configuration. + * This constructor enables client-side caching. + * + * @param hostAndPort The host and port of the Redis server + * @param clientConfig The client configuration + * @param cacheConfig The cache configuration + */ @Experimental public UnifiedJedis(HostAndPort hostAndPort, JedisClientConfig clientConfig, CacheConfig cacheConfig) { this(hostAndPort, clientConfig, CacheFactory.getCache(cacheConfig)); } + /** + * Creates a UnifiedJedis instance with the specified host, port, client configuration, and cache. + * This constructor enables client-side caching with a pre-configured cache. + * + * @param hostAndPort The host and port of the Redis server + * @param clientConfig The client configuration + * @param cache The pre-configured cache + */ @Experimental public UnifiedJedis(HostAndPort hostAndPort, JedisClientConfig clientConfig, Cache cache) { this(new PooledConnectionProvider(hostAndPort, clientConfig, cache), clientConfig.getRedisProtocol(), cache); } + /** + * Creates a UnifiedJedis instance with the specified connection provider. + * + * @param provider The connection provider + */ public UnifiedJedis(ConnectionProvider provider) { this(new DefaultCommandExecutor(provider), provider); } + /** + * Creates a UnifiedJedis instance with the specified connection provider and Redis protocol. + * + * @param provider The connection provider + * @param protocol The Redis protocol version + */ protected UnifiedJedis(ConnectionProvider provider, RedisProtocol protocol) { this(new DefaultCommandExecutor(provider), provider, new CommandObjects(), protocol); } + /** + * Creates a UnifiedJedis instance with the specified connection provider, Redis protocol, and cache. + * This constructor enables client-side caching. + * + * @param provider The connection provider + * @param protocol The Redis protocol version + * @param cache The cache + */ @Experimental protected UnifiedJedis(ConnectionProvider provider, RedisProtocol protocol, Cache cache) { this(new DefaultCommandExecutor(provider), provider, new CommandObjects(), protocol, cache); @@ -168,12 +274,29 @@ public UnifiedJedis(Connection connection) { } } + /** + * Creates a UnifiedJedis instance for a Redis Cluster with the specified nodes, client configuration, and retry attempts. + * + * @param jedisClusterNodes The set of cluster nodes + * @param clientConfig The client configuration + * @param maxAttempts The maximum number of retry attempts + * @deprecated Use constructor with explicit maxTotalRetriesDuration parameter + */ @Deprecated public UnifiedJedis(Set jedisClusterNodes, JedisClientConfig clientConfig, int maxAttempts) { this(jedisClusterNodes, clientConfig, maxAttempts, Duration.ofMillis(maxAttempts * clientConfig.getSocketTimeoutMillis())); } + /** + * Creates a UnifiedJedis instance for a Redis Cluster with the specified nodes, client configuration, and retry parameters. + * + * @param jedisClusterNodes The set of cluster nodes + * @param clientConfig The client configuration + * @param maxAttempts The maximum number of retry attempts + * @param maxTotalRetriesDuration The maximum total duration for retries + * @deprecated Use constructor with ClusterConnectionProvider + */ @Deprecated public UnifiedJedis(Set jedisClusterNodes, JedisClientConfig clientConfig, int maxAttempts, Duration maxTotalRetriesDuration) { @@ -181,6 +304,16 @@ public UnifiedJedis(Set jedisClusterNodes, JedisClientConfig client clientConfig.getRedisProtocol()); } + /** + * Creates a UnifiedJedis instance for a Redis Cluster with the specified nodes, client configuration, pool configuration, and retry parameters. + * + * @param jedisClusterNodes The set of cluster nodes + * @param clientConfig The client configuration + * @param poolConfig The connection pool configuration + * @param maxAttempts The maximum number of retry attempts + * @param maxTotalRetriesDuration The maximum total duration for retries + * @deprecated Use constructor with ClusterConnectionProvider + */ @Deprecated public UnifiedJedis(Set jedisClusterNodes, JedisClientConfig clientConfig, GenericObjectPoolConfig poolConfig, int maxAttempts, Duration maxTotalRetriesDuration) { @@ -188,18 +321,43 @@ public UnifiedJedis(Set jedisClusterNodes, JedisClientConfig client maxTotalRetriesDuration, clientConfig.getRedisProtocol()); } - // Uses a fetched connection to process protocol. Should be avoided if possible. + /** + * Creates a UnifiedJedis instance for a Redis Cluster with the specified connection provider and retry parameters. + * Uses a fetched connection to process protocol. Should be avoided if possible. + * + * @param provider The cluster connection provider + * @param maxAttempts The maximum number of retry attempts + * @param maxTotalRetriesDuration The maximum total duration for retries + */ public UnifiedJedis(ClusterConnectionProvider provider, int maxAttempts, Duration maxTotalRetriesDuration) { this(new ClusterCommandExecutor(provider, maxAttempts, maxTotalRetriesDuration), provider, new ClusterCommandObjects()); } + /** + * Creates a UnifiedJedis instance for a Redis Cluster with the specified connection provider, retry parameters, and protocol. + * + * @param provider The cluster connection provider + * @param maxAttempts The maximum number of retry attempts + * @param maxTotalRetriesDuration The maximum total duration for retries + * @param protocol The Redis protocol version + */ protected UnifiedJedis(ClusterConnectionProvider provider, int maxAttempts, Duration maxTotalRetriesDuration, RedisProtocol protocol) { this(new ClusterCommandExecutor(provider, maxAttempts, maxTotalRetriesDuration), provider, new ClusterCommandObjects(), protocol); } + /** + * Creates a UnifiedJedis instance for a Redis Cluster with the specified connection provider, retry parameters, protocol, and cache. + * This constructor enables client-side caching. + * + * @param provider The cluster connection provider + * @param maxAttempts The maximum number of retry attempts + * @param maxTotalRetriesDuration The maximum total duration for retries + * @param protocol The Redis protocol version + * @param cache The cache + */ @Experimental protected UnifiedJedis(ClusterConnectionProvider provider, int maxAttempts, Duration maxTotalRetriesDuration, RedisProtocol protocol, Cache cache) { @@ -208,6 +366,9 @@ protected UnifiedJedis(ClusterConnectionProvider provider, int maxAttempts, Dura } /** + * Creates a UnifiedJedis instance with a sharded connection provider. + * + * @param provider The sharded connection provider * @deprecated Sharding/Sharded feature will be removed in next major release. */ @Deprecated @@ -216,6 +377,10 @@ public UnifiedJedis(ShardedConnectionProvider provider) { } /** + * Creates a UnifiedJedis instance with a sharded connection provider and tag pattern. + * + * @param provider The sharded connection provider + * @param tagPattern The pattern for extracting key tags * @deprecated Sharding/Sharded feature will be removed in next major release. */ @Deprecated @@ -224,6 +389,13 @@ public UnifiedJedis(ShardedConnectionProvider provider, Pattern tagPattern) { new ShardedCommandObjects(provider.getHashingAlgo(), tagPattern)); } + /** + * Creates a UnifiedJedis instance with the specified connection provider and retry parameters. + * + * @param provider The connection provider + * @param maxAttempts The maximum number of retry attempts + * @param maxTotalRetriesDuration The maximum total duration for retries + */ public UnifiedJedis(ConnectionProvider provider, int maxAttempts, Duration maxTotalRetriesDuration) { this(new RetryableCommandExecutor(provider, maxAttempts, maxTotalRetriesDuration), provider); } @@ -233,7 +405,8 @@ public UnifiedJedis(ConnectionProvider provider, int maxAttempts, Duration maxTo *

* With this Constructor users can seamlessly failover to Disaster Recovery (DR), Backup, and Active-Active cluster(s) * by using simple configuration which is passed through from Resilience4j - https://resilience4j.readme.io/docs - *

+ * + * @param provider The multi-cluster pooled connection provider */ @Experimental public UnifiedJedis(MultiClusterPooledConnectionProvider provider) { @@ -250,11 +423,24 @@ public UnifiedJedis(CommandExecutor executor) { this(executor, (ConnectionProvider) null); } + /** + * Creates a UnifiedJedis instance with the specified command executor and connection provider. + * + * @param executor The command executor + * @param provider The connection provider + */ private UnifiedJedis(CommandExecutor executor, ConnectionProvider provider) { this(executor, provider, new CommandObjects()); } - // Uses a fetched connection to process protocol. Should be avoided if possible. + /** + * Creates a UnifiedJedis instance with the specified command executor, connection provider, and command objects. + * Uses a fetched connection to process protocol. Should be avoided if possible. + * + * @param executor The command executor + * @param provider The connection provider + * @param commandObjects The command objects + */ @VisibleForTesting public UnifiedJedis(CommandExecutor executor, ConnectionProvider provider, CommandObjects commandObjects) { this(executor, provider, commandObjects, null, null); @@ -271,12 +457,31 @@ public UnifiedJedis(CommandExecutor executor, ConnectionProvider provider, Comma } } + /** + * Creates a UnifiedJedis instance with the specified command executor, connection provider, command objects, and protocol. + * + * @param executor The command executor + * @param provider The connection provider + * @param commandObjects The command objects + * @param protocol The Redis protocol version + */ @Experimental private UnifiedJedis(CommandExecutor executor, ConnectionProvider provider, CommandObjects commandObjects, RedisProtocol protocol) { this(executor, provider, commandObjects, protocol, (Cache) null); } + /** + * Creates a UnifiedJedis instance with the specified command executor, connection provider, command objects, protocol, and cache. + * This constructor enables client-side caching. + * + * @param executor The command executor + * @param provider The connection provider + * @param commandObjects The command objects + * @param protocol The Redis protocol version + * @param cache The cache + * @throws IllegalArgumentException if cache is provided but protocol is not RESP3 + */ @Experimental private UnifiedJedis(CommandExecutor executor, ConnectionProvider provider, CommandObjects commandObjects, RedisProtocol protocol, Cache cache) { @@ -1488,12 +1693,12 @@ public long hsetex(String key, HSetExParams params, String field, String value) public long hsetex(String key, HSetExParams params, Map hash) { return executeCommand(commandObjects.hsetex(key, params, hash)); } - + @Override public String hget(String key, String field) { return executeCommand(commandObjects.hget(key, field)); } - + @Override public List hgetex(String key, HGetExParams params, String... fields) { return executeCommand(commandObjects.hgetex(key, params, fields)); @@ -1548,7 +1753,7 @@ public byte[] hget(byte[] key, byte[] field) { public List hgetex(byte[] key, HGetExParams params, byte[]... fields) { return executeCommand(commandObjects.hgetex(key, params, fields)); } - + @Override public List hgetdel(byte[] key, byte[]... fields) { return executeCommand(commandObjects.hgetdel(key, fields)); From a0580f0a82b4e6ddccdbae0f15959d0018468014 Mon Sep 17 00:00:00 2001 From: Josh Rotenberg Date: Mon, 12 May 2025 22:58:05 -0700 Subject: [PATCH 2/3] refix --- src/main/java/redis/clients/jedis/UnifiedJedis.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/redis/clients/jedis/UnifiedJedis.java b/src/main/java/redis/clients/jedis/UnifiedJedis.java index fb75712e6d..5940d85ba4 100644 --- a/src/main/java/redis/clients/jedis/UnifiedJedis.java +++ b/src/main/java/redis/clients/jedis/UnifiedJedis.java @@ -86,10 +86,8 @@ * *

Production usage requires configuration of connection timeouts and connection pooling. * - * @see JedisPool For connection pooling with standalone Redis servers * @see JedisCluster For dedicated Redis Cluster support * @see JedisSentineled For dedicated Redis Sentinel support - * @see JedisSentinelPool For Redis Sentinel connection pooling */ public class UnifiedJedis implements JedisCommands, JedisBinaryCommands, SampleKeyedCommands, SampleBinaryKeyedCommands, RedisModuleCommands, From a2ca2a0221205f56b560ea3171b797a3405c8a97 Mon Sep 17 00:00:00 2001 From: Josh Rotenberg Date: Mon, 12 May 2025 23:06:37 -0700 Subject: [PATCH 3/3] fix: format --- .../redis/clients/jedis/UnifiedJedis.java | 558 +++++++++++------- 1 file changed, 331 insertions(+), 227 deletions(-) diff --git a/src/main/java/redis/clients/jedis/UnifiedJedis.java b/src/main/java/redis/clients/jedis/UnifiedJedis.java index 5940d85ba4..5bdc78f1f5 100644 --- a/src/main/java/redis/clients/jedis/UnifiedJedis.java +++ b/src/main/java/redis/clients/jedis/UnifiedJedis.java @@ -46,52 +46,53 @@ import redis.clients.jedis.util.KeyValue; /** - * UnifiedJedis provides a single interface for multiple Redis deployment types. - * Supports standalone Redis servers, Redis Sentinel, Redis Cluster, and sharded Redis deployments. - * Implements multiple command interfaces for Redis operations. - * - *

Features: + * UnifiedJedis provides a single interface for multiple Redis deployment types. Supports standalone + * Redis servers, Redis Sentinel, Redis Cluster, and sharded Redis deployments. Implements multiple + * command interfaces for Redis operations. + *

+ * Features: *

- * - *

Basic usage with default connection (localhost:6379): + *

+ * Basic usage with default connection (localhost:6379): + * *

  * UnifiedJedis jedis = new UnifiedJedis();
  * jedis.set("key", "value");
  * String value = jedis.get("key");
  * jedis.close();
  * 
- * - *

Usage with specific host and port: + *

+ * Usage with specific host and port: + * *

  * UnifiedJedis jedis = new UnifiedJedis(new HostAndPort("localhost", 6379));
  * jedis.set("key", "value");
  * String value = jedis.get("key");
  * jedis.close();
  * 
- * - *

Usage with URI (including authentication): + *

+ * Usage with URI (including authentication): + * *

  * UnifiedJedis jedis = new UnifiedJedis(URI.create("redis://user:password@localhost:6379/0"));
  * jedis.set("key", "value");
  * String value = jedis.get("key");
  * jedis.close();
  * 
- * - *

Production usage requires configuration of connection timeouts and connection pooling. - * + *

+ * Production usage requires configuration of connection timeouts and connection pooling. * @see JedisCluster For dedicated Redis Cluster support * @see JedisSentineled For dedicated Redis Sentinel support */ -public class UnifiedJedis implements JedisCommands, JedisBinaryCommands, - SampleKeyedCommands, SampleBinaryKeyedCommands, RedisModuleCommands, - AutoCloseable { +public class UnifiedJedis implements JedisCommands, JedisBinaryCommands, SampleKeyedCommands, + SampleBinaryKeyedCommands, RedisModuleCommands, AutoCloseable { @Deprecated protected RedisProtocol protocol = null; @@ -110,7 +111,6 @@ public UnifiedJedis() { /** * Creates a UnifiedJedis instance with the specified host and port. - * * @param hostAndPort The host and port of the Redis server */ public UnifiedJedis(HostAndPort hostAndPort) { @@ -119,7 +119,6 @@ public UnifiedJedis(HostAndPort hostAndPort) { /** * Creates a UnifiedJedis instance with the specified URL. - * * @param url The URL of the Redis server (e.g., "redis://localhost:6379") */ public UnifiedJedis(final String url) { @@ -127,27 +126,25 @@ public UnifiedJedis(final String url) { } /** - * Creates a UnifiedJedis instance with the specified URI. - * The URI can include authentication information, database index, and SSL configuration. - * + * Creates a UnifiedJedis instance with the specified URI. The URI can include authentication + * information, database index, and SSL configuration. * @param uri The URI of the Redis server (e.g., "redis://user:password@localhost:6379/1") */ public UnifiedJedis(final URI uri) { - this(JedisURIHelper.getHostAndPort(uri), DefaultJedisClientConfig.builder() - .user(JedisURIHelper.getUser(uri)).password(JedisURIHelper.getPassword(uri)) - .database(JedisURIHelper.getDBIndex(uri)).protocol(JedisURIHelper.getRedisProtocol(uri)) - .ssl(JedisURIHelper.isRedisSSLScheme(uri)).build()); + this(JedisURIHelper.getHostAndPort(uri), + DefaultJedisClientConfig.builder().user(JedisURIHelper.getUser(uri)) + .password(JedisURIHelper.getPassword(uri)).database(JedisURIHelper.getDBIndex(uri)) + .protocol(JedisURIHelper.getRedisProtocol(uri)) + .ssl(JedisURIHelper.isRedisSSLScheme(uri)).build()); } /** - * Create a new UnifiedJedis with the provided URI and JedisClientConfig object. Note that all fields - * that can be parsed from the URI will be used instead of the corresponding configuration values. This includes - * the following fields: user, password, database, protocol version, and whether to use SSL. - * - * For example, if the URI is "redis://user:password@localhost:6379/1", the user and password fields will be set - * to "user" and "password" respectively, the database field will be set to 1. Those fields will be ignored - * from the JedisClientConfig object. - * + * Create a new UnifiedJedis with the provided URI and JedisClientConfig object. Note that all + * fields that can be parsed from the URI will be used instead of the corresponding configuration + * values. This includes the following fields: user, password, database, protocol version, and + * whether to use SSL. For example, if the URI is "redis://user:password@localhost:6379/1", the + * user and password fields will be set to "user" and "password" respectively, the database field + * will be set to 1. Those fields will be ignored from the JedisClientConfig object. * @param uri The URI to connect to * @param config The JedisClientConfig object to use */ @@ -158,14 +155,13 @@ public UnifiedJedis(final URI uri, JedisClientConfig config) { .blockingSocketTimeoutMillis(config.getBlockingSocketTimeoutMillis()) .user(JedisURIHelper.getUser(uri)).password(JedisURIHelper.getPassword(uri)) .database(JedisURIHelper.getDBIndex(uri)).clientName(config.getClientName()) - .protocol(JedisURIHelper.getRedisProtocol(uri)) - .ssl(JedisURIHelper.isRedisSSLScheme(uri)).sslSocketFactory(config.getSslSocketFactory()) - .sslParameters(config.getSslParameters()).hostnameVerifier(config.getHostnameVerifier()).build()); + .protocol(JedisURIHelper.getRedisProtocol(uri)).ssl(JedisURIHelper.isRedisSSLScheme(uri)) + .sslSocketFactory(config.getSslSocketFactory()).sslParameters(config.getSslParameters()) + .hostnameVerifier(config.getHostnameVerifier()).build()); } /** * Creates a UnifiedJedis instance with the specified host, port, and client configuration. - * * @param hostAndPort The host and port of the Redis server * @param clientConfig The client configuration */ @@ -174,34 +170,33 @@ public UnifiedJedis(HostAndPort hostAndPort, JedisClientConfig clientConfig) { } /** - * Creates a UnifiedJedis instance with the specified host, port, client configuration, and cache configuration. - * This constructor enables client-side caching. - * + * Creates a UnifiedJedis instance with the specified host, port, client configuration, and cache + * configuration. This constructor enables client-side caching. * @param hostAndPort The host and port of the Redis server * @param clientConfig The client configuration * @param cacheConfig The cache configuration */ @Experimental - public UnifiedJedis(HostAndPort hostAndPort, JedisClientConfig clientConfig, CacheConfig cacheConfig) { + public UnifiedJedis(HostAndPort hostAndPort, JedisClientConfig clientConfig, + CacheConfig cacheConfig) { this(hostAndPort, clientConfig, CacheFactory.getCache(cacheConfig)); } /** * Creates a UnifiedJedis instance with the specified host, port, client configuration, and cache. * This constructor enables client-side caching with a pre-configured cache. - * * @param hostAndPort The host and port of the Redis server * @param clientConfig The client configuration * @param cache The pre-configured cache */ @Experimental public UnifiedJedis(HostAndPort hostAndPort, JedisClientConfig clientConfig, Cache cache) { - this(new PooledConnectionProvider(hostAndPort, clientConfig, cache), clientConfig.getRedisProtocol(), cache); + this(new PooledConnectionProvider(hostAndPort, clientConfig, cache), + clientConfig.getRedisProtocol(), cache); } /** * Creates a UnifiedJedis instance with the specified connection provider. - * * @param provider The connection provider */ public UnifiedJedis(ConnectionProvider provider) { @@ -210,7 +205,6 @@ public UnifiedJedis(ConnectionProvider provider) { /** * Creates a UnifiedJedis instance with the specified connection provider and Redis protocol. - * * @param provider The connection provider * @param protocol The Redis protocol version */ @@ -219,9 +213,8 @@ protected UnifiedJedis(ConnectionProvider provider, RedisProtocol protocol) { } /** - * Creates a UnifiedJedis instance with the specified connection provider, Redis protocol, and cache. - * This constructor enables client-side caching. - * + * Creates a UnifiedJedis instance with the specified connection provider, Redis protocol, and + * cache. This constructor enables client-side caching. * @param provider The connection provider * @param protocol The Redis protocol version * @param cache The cache @@ -273,22 +266,23 @@ public UnifiedJedis(Connection connection) { } /** - * Creates a UnifiedJedis instance for a Redis Cluster with the specified nodes, client configuration, and retry attempts. - * + * Creates a UnifiedJedis instance for a Redis Cluster with the specified nodes, client + * configuration, and retry attempts. * @param jedisClusterNodes The set of cluster nodes * @param clientConfig The client configuration * @param maxAttempts The maximum number of retry attempts * @deprecated Use constructor with explicit maxTotalRetriesDuration parameter */ @Deprecated - public UnifiedJedis(Set jedisClusterNodes, JedisClientConfig clientConfig, int maxAttempts) { + public UnifiedJedis(Set jedisClusterNodes, JedisClientConfig clientConfig, + int maxAttempts) { this(jedisClusterNodes, clientConfig, maxAttempts, Duration.ofMillis(maxAttempts * clientConfig.getSocketTimeoutMillis())); } /** - * Creates a UnifiedJedis instance for a Redis Cluster with the specified nodes, client configuration, and retry parameters. - * + * Creates a UnifiedJedis instance for a Redis Cluster with the specified nodes, client + * configuration, and retry parameters. * @param jedisClusterNodes The set of cluster nodes * @param clientConfig The client configuration * @param maxAttempts The maximum number of retry attempts @@ -296,15 +290,15 @@ public UnifiedJedis(Set jedisClusterNodes, JedisClientConfig client * @deprecated Use constructor with ClusterConnectionProvider */ @Deprecated - public UnifiedJedis(Set jedisClusterNodes, JedisClientConfig clientConfig, int maxAttempts, - Duration maxTotalRetriesDuration) { - this(new ClusterConnectionProvider(jedisClusterNodes, clientConfig), maxAttempts, maxTotalRetriesDuration, - clientConfig.getRedisProtocol()); + public UnifiedJedis(Set jedisClusterNodes, JedisClientConfig clientConfig, + int maxAttempts, Duration maxTotalRetriesDuration) { + this(new ClusterConnectionProvider(jedisClusterNodes, clientConfig), maxAttempts, + maxTotalRetriesDuration, clientConfig.getRedisProtocol()); } /** - * Creates a UnifiedJedis instance for a Redis Cluster with the specified nodes, client configuration, pool configuration, and retry parameters. - * + * Creates a UnifiedJedis instance for a Redis Cluster with the specified nodes, client + * configuration, pool configuration, and retry parameters. * @param jedisClusterNodes The set of cluster nodes * @param clientConfig The client configuration * @param poolConfig The connection pool configuration @@ -314,42 +308,42 @@ public UnifiedJedis(Set jedisClusterNodes, JedisClientConfig client */ @Deprecated public UnifiedJedis(Set jedisClusterNodes, JedisClientConfig clientConfig, - GenericObjectPoolConfig poolConfig, int maxAttempts, Duration maxTotalRetriesDuration) { + GenericObjectPoolConfig poolConfig, int maxAttempts, + Duration maxTotalRetriesDuration) { this(new ClusterConnectionProvider(jedisClusterNodes, clientConfig, poolConfig), maxAttempts, maxTotalRetriesDuration, clientConfig.getRedisProtocol()); } /** - * Creates a UnifiedJedis instance for a Redis Cluster with the specified connection provider and retry parameters. - * Uses a fetched connection to process protocol. Should be avoided if possible. - * + * Creates a UnifiedJedis instance for a Redis Cluster with the specified connection provider and + * retry parameters. Uses a fetched connection to process protocol. Should be avoided if possible. * @param provider The cluster connection provider * @param maxAttempts The maximum number of retry attempts * @param maxTotalRetriesDuration The maximum total duration for retries */ - public UnifiedJedis(ClusterConnectionProvider provider, int maxAttempts, Duration maxTotalRetriesDuration) { + public UnifiedJedis(ClusterConnectionProvider provider, int maxAttempts, + Duration maxTotalRetriesDuration) { this(new ClusterCommandExecutor(provider, maxAttempts, maxTotalRetriesDuration), provider, new ClusterCommandObjects()); } /** - * Creates a UnifiedJedis instance for a Redis Cluster with the specified connection provider, retry parameters, and protocol. - * + * Creates a UnifiedJedis instance for a Redis Cluster with the specified connection provider, + * retry parameters, and protocol. * @param provider The cluster connection provider * @param maxAttempts The maximum number of retry attempts * @param maxTotalRetriesDuration The maximum total duration for retries * @param protocol The Redis protocol version */ - protected UnifiedJedis(ClusterConnectionProvider provider, int maxAttempts, Duration maxTotalRetriesDuration, - RedisProtocol protocol) { + protected UnifiedJedis(ClusterConnectionProvider provider, int maxAttempts, + Duration maxTotalRetriesDuration, RedisProtocol protocol) { this(new ClusterCommandExecutor(provider, maxAttempts, maxTotalRetriesDuration), provider, new ClusterCommandObjects(), protocol); } /** - * Creates a UnifiedJedis instance for a Redis Cluster with the specified connection provider, retry parameters, protocol, and cache. - * This constructor enables client-side caching. - * + * Creates a UnifiedJedis instance for a Redis Cluster with the specified connection provider, + * retry parameters, protocol, and cache. This constructor enables client-side caching. * @param provider The cluster connection provider * @param maxAttempts The maximum number of retry attempts * @param maxTotalRetriesDuration The maximum total duration for retries @@ -357,26 +351,25 @@ protected UnifiedJedis(ClusterConnectionProvider provider, int maxAttempts, Dura * @param cache The cache */ @Experimental - protected UnifiedJedis(ClusterConnectionProvider provider, int maxAttempts, Duration maxTotalRetriesDuration, - RedisProtocol protocol, Cache cache) { + protected UnifiedJedis(ClusterConnectionProvider provider, int maxAttempts, + Duration maxTotalRetriesDuration, RedisProtocol protocol, Cache cache) { this(new ClusterCommandExecutor(provider, maxAttempts, maxTotalRetriesDuration), provider, new ClusterCommandObjects(), protocol, cache); } /** * Creates a UnifiedJedis instance with a sharded connection provider. - * * @param provider The sharded connection provider * @deprecated Sharding/Sharded feature will be removed in next major release. */ @Deprecated public UnifiedJedis(ShardedConnectionProvider provider) { - this(new DefaultCommandExecutor(provider), provider, new ShardedCommandObjects(provider.getHashingAlgo())); + this(new DefaultCommandExecutor(provider), provider, + new ShardedCommandObjects(provider.getHashingAlgo())); } /** * Creates a UnifiedJedis instance with a sharded connection provider and tag pattern. - * * @param provider The sharded connection provider * @param tagPattern The pattern for extracting key tags * @deprecated Sharding/Sharded feature will be removed in next major release. @@ -389,21 +382,22 @@ public UnifiedJedis(ShardedConnectionProvider provider, Pattern tagPattern) { /** * Creates a UnifiedJedis instance with the specified connection provider and retry parameters. - * * @param provider The connection provider * @param maxAttempts The maximum number of retry attempts * @param maxTotalRetriesDuration The maximum total duration for retries */ - public UnifiedJedis(ConnectionProvider provider, int maxAttempts, Duration maxTotalRetriesDuration) { + public UnifiedJedis(ConnectionProvider provider, int maxAttempts, + Duration maxTotalRetriesDuration) { this(new RetryableCommandExecutor(provider, maxAttempts, maxTotalRetriesDuration), provider); } /** - * Constructor which supports multiple cluster/database endpoints each with their own isolated connection pool. + * Constructor which supports multiple cluster/database endpoints each with their own isolated + * connection pool. *

- * With this Constructor users can seamlessly failover to Disaster Recovery (DR), Backup, and Active-Active cluster(s) - * by using simple configuration which is passed through from Resilience4j - https://resilience4j.readme.io/docs - * + * With this Constructor users can seamlessly failover to Disaster Recovery (DR), Backup, and + * Active-Active cluster(s) by using simple configuration which is passed through from + * Resilience4j - https://resilience4j.readme.io/docs * @param provider The multi-cluster pooled connection provider */ @Experimental @@ -423,7 +417,6 @@ public UnifiedJedis(CommandExecutor executor) { /** * Creates a UnifiedJedis instance with the specified command executor and connection provider. - * * @param executor The command executor * @param provider The connection provider */ @@ -432,15 +425,15 @@ private UnifiedJedis(CommandExecutor executor, ConnectionProvider provider) { } /** - * Creates a UnifiedJedis instance with the specified command executor, connection provider, and command objects. - * Uses a fetched connection to process protocol. Should be avoided if possible. - * + * Creates a UnifiedJedis instance with the specified command executor, connection provider, and + * command objects. Uses a fetched connection to process protocol. Should be avoided if possible. * @param executor The command executor * @param provider The connection provider * @param commandObjects The command objects */ @VisibleForTesting - public UnifiedJedis(CommandExecutor executor, ConnectionProvider provider, CommandObjects commandObjects) { + public UnifiedJedis(CommandExecutor executor, ConnectionProvider provider, + CommandObjects commandObjects) { this(executor, provider, commandObjects, null, null); if (this.provider != null) { try (Connection conn = this.provider.getConnection()) { @@ -456,23 +449,22 @@ public UnifiedJedis(CommandExecutor executor, ConnectionProvider provider, Comma } /** - * Creates a UnifiedJedis instance with the specified command executor, connection provider, command objects, and protocol. - * + * Creates a UnifiedJedis instance with the specified command executor, connection provider, + * command objects, and protocol. * @param executor The command executor * @param provider The connection provider * @param commandObjects The command objects * @param protocol The Redis protocol version */ @Experimental - private UnifiedJedis(CommandExecutor executor, ConnectionProvider provider, CommandObjects commandObjects, - RedisProtocol protocol) { + private UnifiedJedis(CommandExecutor executor, ConnectionProvider provider, + CommandObjects commandObjects, RedisProtocol protocol) { this(executor, provider, commandObjects, protocol, (Cache) null); } /** - * Creates a UnifiedJedis instance with the specified command executor, connection provider, command objects, protocol, and cache. - * This constructor enables client-side caching. - * + * Creates a UnifiedJedis instance with the specified command executor, connection provider, + * command objects, protocol, and cache. This constructor enables client-side caching. * @param executor The command executor * @param provider The connection provider * @param commandObjects The command objects @@ -481,8 +473,8 @@ private UnifiedJedis(CommandExecutor executor, ConnectionProvider provider, Comm * @throws IllegalArgumentException if cache is provided but protocol is not RESP3 */ @Experimental - private UnifiedJedis(CommandExecutor executor, ConnectionProvider provider, CommandObjects commandObjects, - RedisProtocol protocol, Cache cache) { + private UnifiedJedis(CommandExecutor executor, ConnectionProvider provider, + CommandObjects commandObjects, RedisProtocol protocol, Cache cache) { if (cache != null && protocol != RedisProtocol.RESP3) { throw new IllegalArgumentException("Client-side caching is only supported with RESP3."); @@ -525,8 +517,8 @@ private T checkAndBroadcastCommand(CommandObject commandObject) { } else if (commandObject.getArguments().getCommand() instanceof SearchProtocol.SearchCommand && broadcastAndRoundRobinConfig .getRediSearchModeInCluster() == JedisBroadcastAndRoundRobinConfig.RediSearchMode.LIGHT) { - broadcast = false; - } + broadcast = false; + } return broadcast ? broadcastCommand(commandObject) : executeCommand(commandObject); } @@ -1616,7 +1608,8 @@ public String lmove(String srcKey, String dstKey, ListDirection from, ListDirect } @Override - public String blmove(String srcKey, String dstKey, ListDirection from, ListDirection to, double timeout) { + public String blmove(String srcKey, String dstKey, ListDirection from, ListDirection to, + double timeout) { return executeCommand(commandObjects.blmove(srcKey, dstKey, from, to, timeout)); } @@ -1626,7 +1619,8 @@ public byte[] lmove(byte[] srcKey, byte[] dstKey, ListDirection from, ListDirect } @Override - public byte[] blmove(byte[] srcKey, byte[] dstKey, ListDirection from, ListDirection to, double timeout) { + public byte[] blmove(byte[] srcKey, byte[] dstKey, ListDirection from, ListDirection to, + double timeout) { return executeCommand(commandObjects.blmove(srcKey, dstKey, from, to, timeout)); } @@ -1641,12 +1635,14 @@ public KeyValue> lmpop(ListDirection direction, int count, } @Override - public KeyValue> blmpop(double timeout, ListDirection direction, String... keys) { + public KeyValue> blmpop(double timeout, ListDirection direction, + String... keys) { return executeCommand(commandObjects.blmpop(timeout, direction, keys)); } @Override - public KeyValue> blmpop(double timeout, ListDirection direction, int count, String... keys) { + public KeyValue> blmpop(double timeout, ListDirection direction, int count, + String... keys) { return executeCommand(commandObjects.blmpop(timeout, direction, count, keys)); } @@ -1661,12 +1657,14 @@ public KeyValue> lmpop(ListDirection direction, int count, } @Override - public KeyValue> blmpop(double timeout, ListDirection direction, byte[]... keys) { + public KeyValue> blmpop(double timeout, ListDirection direction, + byte[]... keys) { return executeCommand(commandObjects.blmpop(timeout, direction, keys)); } @Override - public KeyValue> blmpop(double timeout, ListDirection direction, int count, byte[]... keys) { + public KeyValue> blmpop(double timeout, ListDirection direction, int count, + byte[]... keys) { return executeCommand(commandObjects.blmpop(timeout, direction, count, keys)); } // List commands @@ -1684,7 +1682,7 @@ public long hset(String key, Map hash) { @Override public long hsetex(String key, HSetExParams params, String field, String value) { - return executeCommand(commandObjects.hsetex(key, params, field, value)); + return executeCommand(commandObjects.hsetex(key, params, field, value)); } @Override @@ -1734,7 +1732,7 @@ public long hset(byte[] key, Map hash) { @Override public long hsetex(byte[] key, HSetExParams params, byte[] field, byte[] value) { - return executeCommand(commandObjects.hsetex(key, params, field, value)); + return executeCommand(commandObjects.hsetex(key, params, field, value)); } @Override @@ -1928,7 +1926,8 @@ public List hpexpire(String key, long milliseconds, String... fields) { } @Override - public List hpexpire(String key, long milliseconds, ExpiryOption condition, String... fields) { + public List hpexpire(String key, long milliseconds, ExpiryOption condition, + String... fields) { return executeCommand(commandObjects.hpexpire(key, milliseconds, condition, fields)); } @@ -1938,7 +1937,8 @@ public List hexpireAt(String key, long unixTimeSeconds, String... fields) } @Override - public List hexpireAt(String key, long unixTimeSeconds, ExpiryOption condition, String... fields) { + public List hexpireAt(String key, long unixTimeSeconds, ExpiryOption condition, + String... fields) { return executeCommand(commandObjects.hexpireAt(key, unixTimeSeconds, condition, fields)); } @@ -1948,7 +1948,8 @@ public List hpexpireAt(String key, long unixTimeMillis, String... fields) } @Override - public List hpexpireAt(String key, long unixTimeMillis, ExpiryOption condition, String... fields) { + public List hpexpireAt(String key, long unixTimeMillis, ExpiryOption condition, + String... fields) { return executeCommand(commandObjects.hpexpireAt(key, unixTimeMillis, condition, fields)); } @@ -1968,7 +1969,8 @@ public List hpexpire(byte[] key, long milliseconds, byte[]... fields) { } @Override - public List hpexpire(byte[] key, long milliseconds, ExpiryOption condition, byte[]... fields) { + public List hpexpire(byte[] key, long milliseconds, ExpiryOption condition, + byte[]... fields) { return executeCommand(commandObjects.hpexpire(key, milliseconds, condition, fields)); } @@ -1978,7 +1980,8 @@ public List hexpireAt(byte[] key, long unixTimeSeconds, byte[]... fields) } @Override - public List hexpireAt(byte[] key, long unixTimeSeconds, ExpiryOption condition, byte[]... fields) { + public List hexpireAt(byte[] key, long unixTimeSeconds, ExpiryOption condition, + byte[]... fields) { return executeCommand(commandObjects.hexpireAt(key, unixTimeSeconds, condition, fields)); } @@ -1988,7 +1991,8 @@ public List hpexpireAt(byte[] key, long unixTimeMillis, byte[]... fields) } @Override - public List hpexpireAt(byte[] key, long unixTimeMillis, ExpiryOption condition, byte[]... fields) { + public List hpexpireAt(byte[] key, long unixTimeMillis, ExpiryOption condition, + byte[]... fields) { return executeCommand(commandObjects.hpexpireAt(key, unixTimeMillis, condition, fields)); } @@ -2567,7 +2571,8 @@ public List zrevrangeByScoreWithScores(String key, double max, double min } @Override - public List zrangeByScoreWithScores(String key, double min, double max, int offset, int count) { + public List zrangeByScoreWithScores(String key, double min, double max, int offset, + int count) { return executeCommand(commandObjects.zrangeByScoreWithScores(key, min, max, offset, count)); } @@ -2587,17 +2592,20 @@ public List zrevrangeByScoreWithScores(String key, String max, String min } @Override - public List zrangeByScoreWithScores(String key, String min, String max, int offset, int count) { + public List zrangeByScoreWithScores(String key, String min, String max, int offset, + int count) { return executeCommand(commandObjects.zrangeByScoreWithScores(key, min, max, offset, count)); } @Override - public List zrevrangeByScoreWithScores(String key, double max, double min, int offset, int count) { + public List zrevrangeByScoreWithScores(String key, double max, double min, int offset, + int count) { return executeCommand(commandObjects.zrevrangeByScoreWithScores(key, max, min, offset, count)); } @Override - public List zrevrangeByScoreWithScores(String key, String max, String min, int offset, int count) { + public List zrevrangeByScoreWithScores(String key, String max, String min, int offset, + int count) { return executeCommand(commandObjects.zrevrangeByScoreWithScores(key, max, min, offset, count)); } @@ -2682,7 +2690,8 @@ public List zrevrangeByScoreWithScores(byte[] key, double max, double min } @Override - public List zrangeByScoreWithScores(byte[] key, double min, double max, int offset, int count) { + public List zrangeByScoreWithScores(byte[] key, double min, double max, int offset, + int count) { return executeCommand(commandObjects.zrangeByScoreWithScores(key, min, max, offset, count)); } @@ -2702,17 +2711,20 @@ public List zrevrangeByScoreWithScores(byte[] key, byte[] max, byte[] min } @Override - public List zrangeByScoreWithScores(byte[] key, byte[] min, byte[] max, int offset, int count) { + public List zrangeByScoreWithScores(byte[] key, byte[] min, byte[] max, int offset, + int count) { return executeCommand(commandObjects.zrangeByScoreWithScores(key, min, max, offset, count)); } @Override - public List zrevrangeByScoreWithScores(byte[] key, double max, double min, int offset, int count) { + public List zrevrangeByScoreWithScores(byte[] key, double max, double min, int offset, + int count) { return executeCommand(commandObjects.zrevrangeByScoreWithScores(key, max, min, offset, count)); } @Override - public List zrevrangeByScoreWithScores(byte[] key, byte[] max, byte[] min, int offset, int count) { + public List zrevrangeByScoreWithScores(byte[] key, byte[] max, byte[] min, int offset, + int count) { return executeCommand(commandObjects.zrevrangeByScoreWithScores(key, max, min, offset, count)); } @@ -2989,12 +3001,14 @@ public KeyValue> zmpop(SortedSetOption option, int count, St } @Override - public KeyValue> bzmpop(double timeout, SortedSetOption option, String... keys) { + public KeyValue> bzmpop(double timeout, SortedSetOption option, + String... keys) { return executeCommand(commandObjects.bzmpop(timeout, option, keys)); } @Override - public KeyValue> bzmpop(double timeout, SortedSetOption option, int count, String... keys) { + public KeyValue> bzmpop(double timeout, SortedSetOption option, int count, + String... keys) { return executeCommand(commandObjects.bzmpop(timeout, option, count, keys)); } @@ -3009,12 +3023,14 @@ public KeyValue> zmpop(SortedSetOption option, int count, by } @Override - public KeyValue> bzmpop(double timeout, SortedSetOption option, byte[]... keys) { + public KeyValue> bzmpop(double timeout, SortedSetOption option, + byte[]... keys) { return executeCommand(commandObjects.bzmpop(timeout, option, keys)); } @Override - public KeyValue> bzmpop(double timeout, SortedSetOption option, int count, byte[]... keys) { + public KeyValue> bzmpop(double timeout, SortedSetOption option, int count, + byte[]... keys) { return executeCommand(commandObjects.bzmpop(timeout, option, count, keys)); } // Sorted Set commands @@ -3031,7 +3047,8 @@ public long geoadd(String key, Map memberCoordinateMap) { } @Override - public long geoadd(String key, GeoAddParams params, Map memberCoordinateMap) { + public long geoadd(String key, GeoAddParams params, + Map memberCoordinateMap) { return executeCommand(commandObjects.geoadd(key, params, memberCoordinateMap)); } @@ -3066,7 +3083,8 @@ public long geoadd(byte[] key, Map memberCoordinateMap) { } @Override - public long geoadd(byte[] key, GeoAddParams params, Map memberCoordinateMap) { + public long geoadd(byte[] key, GeoAddParams params, + Map memberCoordinateMap) { return executeCommand(commandObjects.geoadd(key, params, memberCoordinateMap)); } @@ -3091,53 +3109,67 @@ public List geopos(byte[] key, byte[]... members) { } @Override - public List georadius(String key, double longitude, double latitude, double radius, GeoUnit unit) { + public List georadius(String key, double longitude, double latitude, + double radius, GeoUnit unit) { return executeCommand(commandObjects.georadius(key, longitude, latitude, radius, unit)); } @Override - public List georadiusReadonly(String key, double longitude, double latitude, double radius, GeoUnit unit) { + public List georadiusReadonly(String key, double longitude, double latitude, + double radius, GeoUnit unit) { return executeCommand(commandObjects.georadiusReadonly(key, longitude, latitude, radius, unit)); } @Override - public List georadius(String key, double longitude, double latitude, double radius, GeoUnit unit, GeoRadiusParam param) { + public List georadius(String key, double longitude, double latitude, + double radius, GeoUnit unit, GeoRadiusParam param) { return executeCommand(commandObjects.georadius(key, longitude, latitude, radius, unit, param)); } @Override - public List georadiusReadonly(String key, double longitude, double latitude, double radius, GeoUnit unit, GeoRadiusParam param) { - return executeCommand(commandObjects.georadiusReadonly(key, longitude, latitude, radius, unit, param)); + public List georadiusReadonly(String key, double longitude, double latitude, + double radius, GeoUnit unit, GeoRadiusParam param) { + return executeCommand( + commandObjects.georadiusReadonly(key, longitude, latitude, radius, unit, param)); } @Override - public List georadiusByMember(String key, String member, double radius, GeoUnit unit) { + public List georadiusByMember(String key, String member, double radius, + GeoUnit unit) { return executeCommand(commandObjects.georadiusByMember(key, member, radius, unit)); } @Override - public List georadiusByMemberReadonly(String key, String member, double radius, GeoUnit unit) { + public List georadiusByMemberReadonly(String key, String member, double radius, + GeoUnit unit) { return executeCommand(commandObjects.georadiusByMemberReadonly(key, member, radius, unit)); } @Override - public List georadiusByMember(String key, String member, double radius, GeoUnit unit, GeoRadiusParam param) { + public List georadiusByMember(String key, String member, double radius, + GeoUnit unit, GeoRadiusParam param) { return executeCommand(commandObjects.georadiusByMember(key, member, radius, unit, param)); } @Override - public List georadiusByMemberReadonly(String key, String member, double radius, GeoUnit unit, GeoRadiusParam param) { - return executeCommand(commandObjects.georadiusByMemberReadonly(key, member, radius, unit, param)); + public List georadiusByMemberReadonly(String key, String member, double radius, + GeoUnit unit, GeoRadiusParam param) { + return executeCommand( + commandObjects.georadiusByMemberReadonly(key, member, radius, unit, param)); } @Override - public long georadiusStore(String key, double longitude, double latitude, double radius, GeoUnit unit, GeoRadiusParam param, GeoRadiusStoreParam storeParam) { - return executeCommand(commandObjects.georadiusStore(key, longitude, latitude, radius, unit, param, storeParam)); + public long georadiusStore(String key, double longitude, double latitude, double radius, + GeoUnit unit, GeoRadiusParam param, GeoRadiusStoreParam storeParam) { + return executeCommand( + commandObjects.georadiusStore(key, longitude, latitude, radius, unit, param, storeParam)); } @Override - public long georadiusByMemberStore(String key, String member, double radius, GeoUnit unit, GeoRadiusParam param, GeoRadiusStoreParam storeParam) { - return executeCommand(commandObjects.georadiusByMemberStore(key, member, radius, unit, param, storeParam)); + public long georadiusByMemberStore(String key, String member, double radius, GeoUnit unit, + GeoRadiusParam param, GeoRadiusStoreParam storeParam) { + return executeCommand( + commandObjects.georadiusByMemberStore(key, member, radius, unit, param, storeParam)); } @Override @@ -3146,17 +3178,20 @@ public List geosearch(String key, String member, double radiu } @Override - public List geosearch(String key, GeoCoordinate coord, double radius, GeoUnit unit) { + public List geosearch(String key, GeoCoordinate coord, double radius, + GeoUnit unit) { return executeCommand(commandObjects.geosearch(key, coord, radius, unit)); } @Override - public List geosearch(String key, String member, double width, double height, GeoUnit unit) { + public List geosearch(String key, String member, double width, double height, + GeoUnit unit) { return executeCommand(commandObjects.geosearch(key, member, width, height, unit)); } @Override - public List geosearch(String key, GeoCoordinate coord, double width, double height, GeoUnit unit) { + public List geosearch(String key, GeoCoordinate coord, double width, + double height, GeoUnit unit) { return executeCommand(commandObjects.geosearch(key, coord, width, height, unit)); } @@ -3171,17 +3206,20 @@ public long geosearchStore(String dest, String src, String member, double radius } @Override - public long geosearchStore(String dest, String src, GeoCoordinate coord, double radius, GeoUnit unit) { + public long geosearchStore(String dest, String src, GeoCoordinate coord, double radius, + GeoUnit unit) { return executeCommand(commandObjects.geosearchStore(dest, src, coord, radius, unit)); } @Override - public long geosearchStore(String dest, String src, String member, double width, double height, GeoUnit unit) { + public long geosearchStore(String dest, String src, String member, double width, double height, + GeoUnit unit) { return executeCommand(commandObjects.geosearchStore(dest, src, member, width, height, unit)); } @Override - public long geosearchStore(String dest, String src, GeoCoordinate coord, double width, double height, GeoUnit unit) { + public long geosearchStore(String dest, String src, GeoCoordinate coord, double width, + double height, GeoUnit unit) { return executeCommand(commandObjects.geosearchStore(dest, src, coord, width, height, unit)); } @@ -3196,53 +3234,67 @@ public long geosearchStoreStoreDist(String dest, String src, GeoSearchParam para } @Override - public List georadius(byte[] key, double longitude, double latitude, double radius, GeoUnit unit) { + public List georadius(byte[] key, double longitude, double latitude, + double radius, GeoUnit unit) { return executeCommand(commandObjects.georadius(key, longitude, latitude, radius, unit)); } @Override - public List georadiusReadonly(byte[] key, double longitude, double latitude, double radius, GeoUnit unit) { + public List georadiusReadonly(byte[] key, double longitude, double latitude, + double radius, GeoUnit unit) { return executeCommand(commandObjects.georadiusReadonly(key, longitude, latitude, radius, unit)); } @Override - public List georadius(byte[] key, double longitude, double latitude, double radius, GeoUnit unit, GeoRadiusParam param) { + public List georadius(byte[] key, double longitude, double latitude, + double radius, GeoUnit unit, GeoRadiusParam param) { return executeCommand(commandObjects.georadius(key, longitude, latitude, radius, unit, param)); } @Override - public List georadiusReadonly(byte[] key, double longitude, double latitude, double radius, GeoUnit unit, GeoRadiusParam param) { - return executeCommand(commandObjects.georadiusReadonly(key, longitude, latitude, radius, unit, param)); + public List georadiusReadonly(byte[] key, double longitude, double latitude, + double radius, GeoUnit unit, GeoRadiusParam param) { + return executeCommand( + commandObjects.georadiusReadonly(key, longitude, latitude, radius, unit, param)); } @Override - public List georadiusByMember(byte[] key, byte[] member, double radius, GeoUnit unit) { + public List georadiusByMember(byte[] key, byte[] member, double radius, + GeoUnit unit) { return executeCommand(commandObjects.georadiusByMember(key, member, radius, unit)); } @Override - public List georadiusByMemberReadonly(byte[] key, byte[] member, double radius, GeoUnit unit) { + public List georadiusByMemberReadonly(byte[] key, byte[] member, double radius, + GeoUnit unit) { return executeCommand(commandObjects.georadiusByMemberReadonly(key, member, radius, unit)); } @Override - public List georadiusByMember(byte[] key, byte[] member, double radius, GeoUnit unit, GeoRadiusParam param) { + public List georadiusByMember(byte[] key, byte[] member, double radius, + GeoUnit unit, GeoRadiusParam param) { return executeCommand(commandObjects.georadiusByMember(key, member, radius, unit, param)); } @Override - public List georadiusByMemberReadonly(byte[] key, byte[] member, double radius, GeoUnit unit, GeoRadiusParam param) { - return executeCommand(commandObjects.georadiusByMemberReadonly(key, member, radius, unit, param)); + public List georadiusByMemberReadonly(byte[] key, byte[] member, double radius, + GeoUnit unit, GeoRadiusParam param) { + return executeCommand( + commandObjects.georadiusByMemberReadonly(key, member, radius, unit, param)); } @Override - public long georadiusStore(byte[] key, double longitude, double latitude, double radius, GeoUnit unit, GeoRadiusParam param, GeoRadiusStoreParam storeParam) { - return executeCommand(commandObjects.georadiusStore(key, longitude, latitude, radius, unit, param, storeParam)); + public long georadiusStore(byte[] key, double longitude, double latitude, double radius, + GeoUnit unit, GeoRadiusParam param, GeoRadiusStoreParam storeParam) { + return executeCommand( + commandObjects.georadiusStore(key, longitude, latitude, radius, unit, param, storeParam)); } @Override - public long georadiusByMemberStore(byte[] key, byte[] member, double radius, GeoUnit unit, GeoRadiusParam param, GeoRadiusStoreParam storeParam) { - return executeCommand(commandObjects.georadiusByMemberStore(key, member, radius, unit, param, storeParam)); + public long georadiusByMemberStore(byte[] key, byte[] member, double radius, GeoUnit unit, + GeoRadiusParam param, GeoRadiusStoreParam storeParam) { + return executeCommand( + commandObjects.georadiusByMemberStore(key, member, radius, unit, param, storeParam)); } @Override @@ -3251,17 +3303,20 @@ public List geosearch(byte[] key, byte[] member, double radiu } @Override - public List geosearch(byte[] key, GeoCoordinate coord, double radius, GeoUnit unit) { + public List geosearch(byte[] key, GeoCoordinate coord, double radius, + GeoUnit unit) { return executeCommand(commandObjects.geosearch(key, coord, radius, unit)); } @Override - public List geosearch(byte[] key, byte[] member, double width, double height, GeoUnit unit) { + public List geosearch(byte[] key, byte[] member, double width, double height, + GeoUnit unit) { return executeCommand(commandObjects.geosearch(key, member, width, height, unit)); } @Override - public List geosearch(byte[] key, GeoCoordinate coord, double width, double height, GeoUnit unit) { + public List geosearch(byte[] key, GeoCoordinate coord, double width, + double height, GeoUnit unit) { return executeCommand(commandObjects.geosearch(key, coord, width, height, unit)); } @@ -3276,17 +3331,20 @@ public long geosearchStore(byte[] dest, byte[] src, byte[] member, double radius } @Override - public long geosearchStore(byte[] dest, byte[] src, GeoCoordinate coord, double radius, GeoUnit unit) { + public long geosearchStore(byte[] dest, byte[] src, GeoCoordinate coord, double radius, + GeoUnit unit) { return executeCommand(commandObjects.geosearchStore(dest, src, coord, radius, unit)); } @Override - public long geosearchStore(byte[] dest, byte[] src, byte[] member, double width, double height, GeoUnit unit) { + public long geosearchStore(byte[] dest, byte[] src, byte[] member, double width, double height, + GeoUnit unit) { return executeCommand(commandObjects.geosearchStore(dest, src, member, width, height, unit)); } @Override - public long geosearchStore(byte[] dest, byte[] src, GeoCoordinate coord, double width, double height, GeoUnit unit) { + public long geosearchStore(byte[] dest, byte[] src, GeoCoordinate coord, double width, + double height, GeoUnit unit) { return executeCommand(commandObjects.geosearchStore(dest, src, coord, width, height, unit)); } @@ -3375,7 +3433,8 @@ public List xrevrange(String key, StreamEntryID end, StreamEntryID } @Override - public List xrevrange(String key, StreamEntryID end, StreamEntryID start, int count) { + public List xrevrange(String key, StreamEntryID end, StreamEntryID start, + int count) { return executeCommand(commandObjects.xrevrange(key, end, start, count)); } @@ -3455,23 +3514,31 @@ public long xtrim(String key, XTrimParams params) { } @Override - public List xclaim(String key, String group, String consumerName, long minIdleTime, XClaimParams params, StreamEntryID... ids) { - return executeCommand(commandObjects.xclaim(key, group, consumerName, minIdleTime, params, ids)); + public List xclaim(String key, String group, String consumerName, long minIdleTime, + XClaimParams params, StreamEntryID... ids) { + return executeCommand( + commandObjects.xclaim(key, group, consumerName, minIdleTime, params, ids)); } @Override - public List xclaimJustId(String key, String group, String consumerName, long minIdleTime, XClaimParams params, StreamEntryID... ids) { - return executeCommand(commandObjects.xclaimJustId(key, group, consumerName, minIdleTime, params, ids)); + public List xclaimJustId(String key, String group, String consumerName, + long minIdleTime, XClaimParams params, StreamEntryID... ids) { + return executeCommand( + commandObjects.xclaimJustId(key, group, consumerName, minIdleTime, params, ids)); } @Override - public Map.Entry> xautoclaim(String key, String group, String consumerName, long minIdleTime, StreamEntryID start, XAutoClaimParams params) { - return executeCommand(commandObjects.xautoclaim(key, group, consumerName, minIdleTime, start, params)); + public Map.Entry> xautoclaim(String key, String group, + String consumerName, long minIdleTime, StreamEntryID start, XAutoClaimParams params) { + return executeCommand( + commandObjects.xautoclaim(key, group, consumerName, minIdleTime, start, params)); } @Override - public Map.Entry> xautoclaimJustId(String key, String group, String consumerName, long minIdleTime, StreamEntryID start, XAutoClaimParams params) { - return executeCommand(commandObjects.xautoclaimJustId(key, group, consumerName, minIdleTime, start, params)); + public Map.Entry> xautoclaimJustId(String key, String group, + String consumerName, long minIdleTime, StreamEntryID start, XAutoClaimParams params) { + return executeCommand( + commandObjects.xautoclaimJustId(key, group, consumerName, minIdleTime, start, params)); } @Override @@ -3505,23 +3572,29 @@ public List xinfoConsumers2(String key, String group) { } @Override - public List>> xread(XReadParams xReadParams, Map streams) { + public List>> xread(XReadParams xReadParams, + Map streams) { return executeCommand(commandObjects.xread(xReadParams, streams)); } @Override - public Map> xreadAsMap(XReadParams xReadParams, Map streams) { + public Map> xreadAsMap(XReadParams xReadParams, + Map streams) { return executeCommand(commandObjects.xreadAsMap(xReadParams, streams)); } @Override - public List>> xreadGroup(String groupName, String consumer, XReadGroupParams xReadGroupParams, Map streams) { - return executeCommand(commandObjects.xreadGroup(groupName, consumer, xReadGroupParams, streams)); + public List>> xreadGroup(String groupName, String consumer, + XReadGroupParams xReadGroupParams, Map streams) { + return executeCommand( + commandObjects.xreadGroup(groupName, consumer, xReadGroupParams, streams)); } @Override - public Map> xreadGroupAsMap(String groupName, String consumer, XReadGroupParams xReadGroupParams, Map streams) { - return executeCommand(commandObjects.xreadGroupAsMap(groupName, consumer, xReadGroupParams, streams)); + public Map> xreadGroupAsMap(String groupName, String consumer, + XReadGroupParams xReadGroupParams, Map streams) { + return executeCommand( + commandObjects.xreadGroupAsMap(groupName, consumer, xReadGroupParams, streams)); } @Override @@ -3610,23 +3683,31 @@ public List xpending(byte[] key, byte[] groupName, XPendingParams params } @Override - public List xclaim(byte[] key, byte[] group, byte[] consumerName, long minIdleTime, XClaimParams params, byte[]... ids) { - return executeCommand(commandObjects.xclaim(key, group, consumerName, minIdleTime, params, ids)); + public List xclaim(byte[] key, byte[] group, byte[] consumerName, long minIdleTime, + XClaimParams params, byte[]... ids) { + return executeCommand( + commandObjects.xclaim(key, group, consumerName, minIdleTime, params, ids)); } @Override - public List xclaimJustId(byte[] key, byte[] group, byte[] consumerName, long minIdleTime, XClaimParams params, byte[]... ids) { - return executeCommand(commandObjects.xclaimJustId(key, group, consumerName, minIdleTime, params, ids)); + public List xclaimJustId(byte[] key, byte[] group, byte[] consumerName, long minIdleTime, + XClaimParams params, byte[]... ids) { + return executeCommand( + commandObjects.xclaimJustId(key, group, consumerName, minIdleTime, params, ids)); } @Override - public List xautoclaim(byte[] key, byte[] groupName, byte[] consumerName, long minIdleTime, byte[] start, XAutoClaimParams params) { - return executeCommand(commandObjects.xautoclaim(key, groupName, consumerName, minIdleTime, start, params)); + public List xautoclaim(byte[] key, byte[] groupName, byte[] consumerName, + long minIdleTime, byte[] start, XAutoClaimParams params) { + return executeCommand( + commandObjects.xautoclaim(key, groupName, consumerName, minIdleTime, start, params)); } @Override - public List xautoclaimJustId(byte[] key, byte[] groupName, byte[] consumerName, long minIdleTime, byte[] start, XAutoClaimParams params) { - return executeCommand(commandObjects.xautoclaimJustId(key, groupName, consumerName, minIdleTime, start, params)); + public List xautoclaimJustId(byte[] key, byte[] groupName, byte[] consumerName, + long minIdleTime, byte[] start, XAutoClaimParams params) { + return executeCommand( + commandObjects.xautoclaimJustId(key, groupName, consumerName, minIdleTime, start, params)); } @Override @@ -3660,8 +3741,10 @@ public List xread(XReadParams xReadParams, Map.Entry... } @Override - public List xreadGroup(byte[] groupName, byte[] consumer, XReadGroupParams xReadGroupParams, Map.Entry... streams) { - return executeCommand(commandObjects.xreadGroup(groupName, consumer, xReadGroupParams, streams)); + public List xreadGroup(byte[] groupName, byte[] consumer, + XReadGroupParams xReadGroupParams, Map.Entry... streams) { + return executeCommand( + commandObjects.xreadGroup(groupName, consumer, xReadGroupParams, streams)); } // Stream commands @@ -3951,12 +4034,14 @@ public long waitReplicas(byte[] sampleKey, int replicas, long timeout) { } @Override - public KeyValue waitAOF(String sampleKey, long numLocal, long numReplicas, long timeout) { + public KeyValue waitAOF(String sampleKey, long numLocal, long numReplicas, + long timeout) { return executeCommand(commandObjects.waitAOF(sampleKey, numLocal, numReplicas, timeout)); } @Override - public KeyValue waitAOF(byte[] sampleKey, long numLocal, long numReplicas, long timeout) { + public KeyValue waitAOF(byte[] sampleKey, long numLocal, long numReplicas, + long timeout) { return executeCommand(commandObjects.waitAOF(sampleKey, numLocal, numReplicas, timeout)); } @@ -4110,7 +4195,8 @@ public String ftCreate(String indexName, IndexOptions indexOptions, Schema schem } @Override - public String ftCreate(String indexName, FTCreateParams createParams, Iterable schemaFields) { + public String ftCreate(String indexName, FTCreateParams createParams, + Iterable schemaFields) { return checkAndBroadcastCommand(commandObjects.ftCreate(indexName, createParams, schemaFields)); } @@ -4161,15 +4247,16 @@ public SearchResult ftSearch(String indexName, String query, FTSearchParams para /** * {@link FTSearchParams#limit(int, int)} will be ignored. - * * @param batchSize batch size * @param indexName index name * @param query query * @param params limit will be ignored * @return search iteration */ - public FtSearchIteration ftSearchIteration(int batchSize, String indexName, String query, FTSearchParams params) { - return new FtSearchIteration(provider, commandObjects.getProtocol(), batchSize, indexName, query, params); + public FtSearchIteration ftSearchIteration(int batchSize, String indexName, String query, + FTSearchParams params) { + return new FtSearchIteration(provider, commandObjects.getProtocol(), batchSize, indexName, + query, params); } @Override @@ -4185,7 +4272,8 @@ public SearchResult ftSearch(String indexName, Query query) { * @return search iteration */ public FtSearchIteration ftSearchIteration(int batchSize, String indexName, Query query) { - return new FtSearchIteration(provider, commandObjects.getProtocol(), batchSize, indexName, query); + return new FtSearchIteration(provider, commandObjects.getProtocol(), batchSize, indexName, + query); } @Override @@ -4244,7 +4332,8 @@ public Map.Entry ftProfileSearch(String indexName, @Override public Map.Entry ftProfileSearch(String indexName, FTProfileParams profileParams, String query, FTSearchParams searchParams) { - return executeCommand(commandObjects.ftProfileSearch(indexName, profileParams, query, searchParams)); + return executeCommand( + commandObjects.ftProfileSearch(indexName, profileParams, query, searchParams)); } @Override @@ -4849,7 +4938,8 @@ public List tsRevRange(String key, TSRangeParams rangeParams) { } @Override - public Map tsMRange(long fromTimestamp, long toTimestamp, String... filters) { + public Map tsMRange(long fromTimestamp, long toTimestamp, + String... filters) { return executeCommand(commandObjects.tsMRange(fromTimestamp, toTimestamp, filters)); } @@ -4859,7 +4949,8 @@ public Map tsMRange(TSMRangeParams multiRangeParams) { } @Override - public Map tsMRevRange(long fromTimestamp, long toTimestamp, String... filters) { + public Map tsMRevRange(long fromTimestamp, long toTimestamp, + String... filters) { return executeCommand(commandObjects.tsMRevRange(fromTimestamp, toTimestamp, filters)); } @@ -4884,14 +4975,17 @@ public Map tsMGet(TSMGetParams multiGetParams, String... } @Override - public String tsCreateRule(String sourceKey, String destKey, AggregationType aggregationType, long timeBucket) { - return executeCommand(commandObjects.tsCreateRule(sourceKey, destKey, aggregationType, timeBucket)); + public String tsCreateRule(String sourceKey, String destKey, AggregationType aggregationType, + long timeBucket) { + return executeCommand( + commandObjects.tsCreateRule(sourceKey, destKey, aggregationType, timeBucket)); } @Override - public String tsCreateRule(String sourceKey, String destKey, AggregationType aggregationType, long bucketDuration, long alignTimestamp) { - return executeCommand( - commandObjects.tsCreateRule(sourceKey, destKey, aggregationType, bucketDuration, alignTimestamp)); + public String tsCreateRule(String sourceKey, String destKey, AggregationType aggregationType, + long bucketDuration, long alignTimestamp) { + return executeCommand(commandObjects.tsCreateRule(sourceKey, destKey, aggregationType, + bucketDuration, alignTimestamp)); } @Override @@ -4922,7 +5016,8 @@ public String bfReserve(String key, double errorRate, long capacity) { } @Override - public String bfReserve(String key, double errorRate, long capacity, BFReserveParams reserveParams) { + public String bfReserve(String key, double errorRate, long capacity, + BFReserveParams reserveParams) { return executeCommand(commandObjects.bfReserve(key, errorRate, capacity, reserveParams)); } @@ -5147,7 +5242,8 @@ public String tdigestMerge(String destinationKey, String... sourceKeys) { } @Override - public String tdigestMerge(TDigestMergeParams mergeParams, String destinationKey, String... sourceKeys) { + public String tdigestMerge(TDigestMergeParams mergeParams, String destinationKey, + String... sourceKeys) { return executeCommand(commandObjects.tdigestMerge(mergeParams, destinationKey, sourceKeys)); } @@ -5212,9 +5308,11 @@ public List tdigestByRevRank(String key, long... ranks) { */ public PipelineBase pipelined() { if (provider == null) { - throw new IllegalStateException("It is not allowed to create Pipeline from this " + getClass()); + throw new IllegalStateException( + "It is not allowed to create Pipeline from this " + getClass()); } else if (provider instanceof MultiClusterPooledConnectionProvider) { - return new MultiClusterPipeline((MultiClusterPooledConnectionProvider) provider, commandObjects); + return new MultiClusterPipeline((MultiClusterPooledConnectionProvider) provider, + commandObjects); } else { return new Pipeline(provider.getConnection(), true, commandObjects); } @@ -5233,9 +5331,11 @@ public AbstractTransaction multi() { */ public AbstractTransaction transaction(boolean doMulti) { if (provider == null) { - throw new IllegalStateException("It is not allowed to create Transaction from this " + getClass()); + throw new IllegalStateException( + "It is not allowed to create Transaction from this " + getClass()); } else if (provider instanceof MultiClusterPooledConnectionProvider) { - return new MultiClusterTransaction((MultiClusterPooledConnectionProvider) provider, doMulti, commandObjects); + return new MultiClusterTransaction((MultiClusterPooledConnectionProvider) provider, doMulti, + commandObjects); } else { return new Transaction(provider.getConnection(), doMulti, true, commandObjects); } @@ -5250,7 +5350,8 @@ public Object sendCommand(ProtocolCommand cmd, byte[]... args) { } public Object sendBlockingCommand(ProtocolCommand cmd, byte[]... args) { - return executeCommand(commandObjects.commandArguments(cmd).addObjects((Object[]) args).blocking()); + return executeCommand( + commandObjects.commandArguments(cmd).addObjects((Object[]) args).blocking()); } public Object sendCommand(ProtocolCommand cmd, String... args) { @@ -5258,25 +5359,28 @@ public Object sendCommand(ProtocolCommand cmd, String... args) { } public Object sendBlockingCommand(ProtocolCommand cmd, String... args) { - return executeCommand(commandObjects.commandArguments(cmd).addObjects((Object[]) args).blocking()); + return executeCommand( + commandObjects.commandArguments(cmd).addObjects((Object[]) args).blocking()); } public Object sendCommand(byte[] sampleKey, ProtocolCommand cmd, byte[]... args) { - return executeCommand(commandObjects.commandArguments(cmd).addObjects((Object[]) args).processKey(sampleKey)); + return executeCommand( + commandObjects.commandArguments(cmd).addObjects((Object[]) args).processKey(sampleKey)); } public Object sendBlockingCommand(byte[] sampleKey, ProtocolCommand cmd, byte[]... args) { - return executeCommand( - commandObjects.commandArguments(cmd).addObjects((Object[]) args).blocking().processKey(sampleKey)); + return executeCommand(commandObjects.commandArguments(cmd).addObjects((Object[]) args) + .blocking().processKey(sampleKey)); } public Object sendCommand(String sampleKey, ProtocolCommand cmd, String... args) { - return executeCommand(commandObjects.commandArguments(cmd).addObjects((Object[]) args).processKey(sampleKey)); + return executeCommand( + commandObjects.commandArguments(cmd).addObjects((Object[]) args).processKey(sampleKey)); } public Object sendBlockingCommand(String sampleKey, ProtocolCommand cmd, String... args) { - return executeCommand( - commandObjects.commandArguments(cmd).addObjects((Object[]) args).blocking().processKey(sampleKey)); + return executeCommand(commandObjects.commandArguments(cmd).addObjects((Object[]) args) + .blocking().processKey(sampleKey)); } public Object executeCommand(CommandArguments args) {