Skip to content

Commit

Permalink
Add javadoc to clear up implicit behavior (#3991)
Browse files Browse the repository at this point in the history
* add javadoc to clear up implicit behavior

* reword this paragraph
  • Loading branch information
joshrotenberg authored Oct 13, 2024
1 parent 8598275 commit bea79a9
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/main/java/redis/clients/jedis/Jedis.java
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,18 @@ public Jedis(final URI uri, final int connectionTimeout, final int soTimeout,
.hostnameVerifier(hostnameVerifier).build());
}

/**
* Create a new Jedis 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
*/
public Jedis(final URI uri, JedisClientConfig config) {
if (!JedisURIHelper.isValid(uri)) {
throw new InvalidURIException(String.format(
Expand Down
12 changes: 12 additions & 0 deletions src/main/java/redis/clients/jedis/UnifiedJedis.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,18 @@ public UnifiedJedis(final URI 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.
*
* @param uri The URI to connect to
* @param config The JedisClientConfig object to use
*/
public UnifiedJedis(final URI uri, JedisClientConfig config) {
this(JedisURIHelper.getHostAndPort(uri), DefaultJedisClientConfig.builder()
.connectionTimeoutMillis(config.getConnectionTimeoutMillis())
Expand Down

0 comments on commit bea79a9

Please sign in to comment.