Skip to content

Commit

Permalink
Merge branch 'master' into setlib-extend
Browse files Browse the repository at this point in the history
  • Loading branch information
sazzad16 committed Sep 4, 2023
2 parents bdc8645 + d6e21ef commit fd56dda
Show file tree
Hide file tree
Showing 11 changed files with 152 additions and 170 deletions.
55 changes: 30 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,23 @@ Jedis is a Java client for [Redis](https://github.com/redis/redis "Redis") desig

Are you looking for a high-level library to handle object mapping? See [redis-om-spring](https://github.com/redis/redis-om-spring)!

## Contributing

We'd love your contributions!

**Bug reports** are always welcome! [You can open a bug report on GitHub](https://github.com/redis/jedis/issues/new).

You can also **contribute documentation** -- or anything to improve Jedis. Please see
[contribution guideline](https://github.com/redis/jedis/blob/master/.github/CONTRIBUTING.md) for more details.

## Supported Redis versions

The most recent version of this library supports redis version [5.0](https://github.com/redis/redis/blob/5.0/00-RELEASENOTES), [6.0](https://github.com/redis/redis/blob/6.0/00-RELEASENOTES), [6.2](https://github.com/redis/redis/blob/6.2/00-RELEASENOTES), and [7.0](https://github.com/redis/redis/blob/7.0/00-RELEASENOTES).
The most recent version of this library supports redis version
[5.0](https://github.com/redis/redis/blob/5.0/00-RELEASENOTES),
[6.0](https://github.com/redis/redis/blob/6.0/00-RELEASENOTES),
[6.2](https://github.com/redis/redis/blob/6.2/00-RELEASENOTES),
[7.0](https://github.com/redis/redis/blob/7.0/00-RELEASENOTES) and
[7.2](https://github.com/redis/redis/blob/7.2/00-RELEASENOTES).

The table below highlights version compatibility of the most-recent library versions and Redis versions. Compatibility means communication features, and Redis command capabilities.


| Library version | Supported redis versions | JDK Compatibility |
|-----------------|--------------------------------|-------------------|
| 3.9+ | 5.0 and 6.2 Family of releases | 8, 11 |
| >= 4.0 | Version 5.0 to current | 8, 11, 17 |
| Jedis version | Supported Redis versions | JDK Compatibility |
|---------------|--------------------------------|-------------------|
| 3.9+ | 5.0 and 6.2 Family of releases | 8, 11 |
| >= 4.0 | Version 5.0 to current | 8, 11, 17 |
| >= 5.0 | Version 6.0 to current | 8, 11, 17 |

## Getting started

Expand All @@ -43,7 +40,7 @@ To get started with Jedis, first add it as a dependency in your Java project. If
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>4.4.3</version>
<version>5.0.0</version>
</dependency>
```

Expand Down Expand Up @@ -109,6 +106,13 @@ Now you can use the `JedisCluster` instance and send commands like you would wit
jedis.sadd("planets", "Mars");
```

## Using Redis modules

Jedis includes support for [Redis modules](https://redis.io/docs/modules/) such as
[RedisJSON](https://oss.redis.com/redisjson/) and [RediSearch](https://oss.redis.com/redisearch/).

See the [RedisJSON Jedis](docs/redisjson.md) or [RediSearch Jedis](docs/redisearch.md) for details.

## Failover

Jedis supports retry and failover for your Redis deployments. This is useful when:
Expand All @@ -127,25 +131,26 @@ You can also check the [latest Jedis Javadocs](https://www.javadoc.io/doc/redis.
Some specific use-case examples can be found in [`redis.clients.jedis.examples`
package](src/test/java/redis/clients/jedis/examples/) of the test source codes.

## Using Redis modules
## Troubleshooting

Jedis includes support for [Redis modules](https://redis.io/docs/modules/) such as
[RedisJSON](https://oss.redis.com/redisjson/) and [RediSearch](https://oss.redis.com/redisearch/).
If you run into trouble or have any questions, we're here to help!

See the [RedisJSON Jedis](docs/redisjson.md) or [RediSearch Jedis](docs/redisearch.md) for details.
Hit us up on the [Redis Discord Server](http://discord.gg/redis) or
[Jedis GitHub Discussions](https://github.com/redis/jedis/discussions) or
[Jedis mailing list](http://groups.google.com/group/jedis_redis).

## Troubleshooting
## Contributing

If you run into trouble or have any questions, we're here to help!
We'd love your contributions!

Hit us up on the [Redis Discord Server](http://discord.gg/redis) or [open an issue on GitHub](https://github.com/redis/jedis).
Bug reports are always welcome! [You can open a bug report on GitHub](https://github.com/redis/jedis/issues/new).

You can also find help on the [Jedis mailing list](http://groups.google.com/group/jedis_redis) or the
[GitHub Discussions](https://github.com/redis/jedis/discussions).
You can also contribute documentation -- or anything to improve Jedis. Please see
[contribution guideline](https://github.com/redis/jedis/blob/master/.github/CONTRIBUTING.md) for more details.

## License

Jedis is licensed under the [MIT license](https://github.com/redis/jedis/blob/master/LICENSE.txt).
Jedis is licensed under the [MIT license](https://github.com/redis/jedis/blob/master/LICENSE).

## Sponsorship

Expand Down
100 changes: 49 additions & 51 deletions docs/jedis5-breaking.md → docs/breaking-5.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
# Jedis 5 Breaking Changes

- All variants of `blmpop` and `bzmpop` methods now take `double timeout` parameter instead of `long timeout` parameter.
This is breaking ONLY IF you are using `Long` for timeout.

- `Reducer` abstract class is refactored:
- **`Reducer(String field)` constructor is removed; `Reducer(String name, String field)` constructor is added.**
- **`Reducer(String name)` constructor is added; it will cause runtime error with older `Reducer(String field)` constructor.**
- `getName` method is removed.
- `getAlias` method is removed.
- `setAlias` method is removed; use `as` method.
- `setAliasAsField` method is removed.
- `getOwnArgs` method is now abstract.
- `getArgs` method is removed.

- `quit()` method has been removed from `Connection` and `ServerCommands` interface and implementations.

- `updatePassword(String password)` method has been removed from `JedisClientConfig` and implementations.

- `setPassword(String password)` method has been removed from both `JedisFactory` and `ConnectionFactory` classes.

- Both `bzpopmax(double timeout, String... keys)` and `bzpopmin(double timeout, String... keys)` now return `KeyValue<String, Tuple>` (instead of `KeyedZSetElement`).

- Both `bzpopmax(double timeout, byte[]... keys)` and `bzpopmin(double timeout, byte[]... keys)` now return `KeyValue<byte[], Tuple>` (instead of `List<byte[]>`).
Expand Down Expand Up @@ -41,7 +60,7 @@
- `tsMRevRange(TSMRangeParams multiRangeParams)`

- `jsonNumIncrBy(String key, Path2 path, double value)` method now returns `Object` instead of `JSONArray`.
- Previously when it was returning JSONArray, returned would still be JSONArray. So simple type casting should be enough to handle this change.
- The returning object would still be JSONArray for all previous cases. So simple type casting is enough to handle this change.
- The returning object will be `List<Double>` when running under RESP3 protocol.

- `getAgeSeconds()` in `AccessControlLogEntry` now returns `Double` instead of `String`.
Expand All @@ -52,7 +71,23 @@

- `graphSlowlog(String graphName)` now returns `List<List<Object>>` (instead of `List<List<String>>`).

- All _payload_ related parameters are removed from _search_ related classes; namely `Document`, `IndexDefinition`, `Query`.
- `CommandListFilterByParams` now throws `IllegalArgumentException` (instead of `JedisDataException`) in case of unfulfilling filter.

- `FailoverParams` now throws `IllegalArgumentException` (instead of `IllegalStateException`) in case of unfulfilling optional arguments.

- `XPendingParams` now throws `IllegalArgumentException` (instead of `IllegalStateException`) in case of unfulfilling optional arguments.

- `get()` option has been removed from `SetParams`. Following methods have been added in Jedis/UnifiedJedis for convenience:
- `setGet(String key, String value)` method has been added in `StringCommands` interface.
- `setGet(byte[] key, byte[] value)` method has been added in `StringBinaryCommands` interface.

- `xpending(String key, String groupName, StreamEntryID start, StreamEntryID end, int count, String consumerName)` method has been removed from everywhere.
- Use `xpending(java.lang.String, java.lang.String, redis.clients.jedis.params.XPendingParams)` instead.

- `xpending(byte[] key, byte[] groupName, byte[] start, byte[] end, int count, byte[] consumerName)` method has been removed from everywhere.
- Use `xpending(byte[], byte[], redis.clients.jedis.params.XPendingParams)` instead.

- `retentionTime(long retentionTime)` method in `TSAlterParams` has been removed. Use `retention(long)` method instead.

- Following classes have been removed:
- `KeyedZSetElement`
Expand All @@ -67,76 +102,47 @@
- `BINARY_MAP_FROM_PAIRS`
- `STRING_ORDERED_SET`

- All _payload_ related parameters are removed from _search_ related classes; namely `Document`, `IndexDefinition`, `Query`.

- `topkCount(String key, String... items)` method has been removed from everywhere.

- Following methods supporting JSON.RESP command have been removed:
- `jsonResp(String key)`
- `jsonResp(String key, Path path)`
- `jsonResp(String key, Path2 path)`

- `RedisJsonCommands` and `RedisJsonPipelineCommands` interfaces have been moved into `redis.clients.jedis.json.commands` package.

- `AbortedTransactionException` is removed.

- `Queable` class is removed.

- `Params` abstract class is removed.
- `toString()` support used by its sub-classes is now unavailable.

- `CommandListFilterByParams` now throws `IllegalArgumentException` (instead of `JedisDataException`) in case of unfulfilling filter.

- `FailoverParams` now throws `IllegalArgumentException` (instead of `IllegalStateException`) in case of unfulfilling optional arguments.

- `XPendingParams` now throws `IllegalArgumentException` (instead of `IllegalStateException`) in case of unfulfilling optional arguments.

- `getParams()` method is removed from `SortingParams` class.

- Both `SEARCH_AGGREGATION_RESULT` and `SEARCH_AGGREGATION_RESULT_WITH_CURSOR` implementations from `SearchBuilderFactory` class have been moved to `AggregationResult` class.

- All `AggregationResult` constructors have been made `private`.

- `addCommandEncodedArguments` and `addCommandBinaryArguments` methods have been removed from `FieldName` class.

- `getArgs` method is removed from `AggregationBuilder` class.

- `limit` and `getArgs` methods have been removed from `Group` class.

- `Reducer` abstract class is refactored:
- `Reducer(String field)` constructor is removed; `Reducer(String name, String field)` constructor is added.
- `Reducer(String name)` constructor is added; it will cause runtime error with older `Reducer(String field)` constructor.
- `getName` method is removed.
- `getAlias` method is removed.
- `setAlias` method is removed; use `as` method.
- `setAliasAsField` method is removed.
- `getOwnArgs` method is now abstract.
- `getArgs` method is removed.

- All variants of `blmpop` and `bzmpop` methods now take `double timeout` parameter instead of `long timeout` parameter.
This is breaking ONLY IF you are using `Long` for timeout.

<!--- Deprecated in Jedis 4 --->

- `quit()` method has been removed from `Connection` and `ServerCommands` interface and implementations.

- `updatePassword(String password)` method has been removed from `JedisClientConfig` and implementations.

- `setPassword(String password)` method has been removed from both `JedisFactory` and `ConnectionFactory` classes.
- `getArgs()`, `getArgsString()` and `serializeRedisArgs(List<byte[]> redisArgs)` methods have been removed from `AggregationBuilder`.

- `get()` option has been removed from `SetParams`. Following methods have been added in Jedis/UnifiedJedis for convenience:
- `setGet(String key, String value)` method has been added in `StringCommands` interface.
- `setGet(byte[] key, byte[] value)` method has been added in `StringBinaryCommands` interface.
- `totalResults` variable in `AggregationResult` has been made private. Use `getTotalResults()` method instead.

- `xpending(String key, String groupName, StreamEntryID start, StreamEntryID end, int count, String consumerName)` method has been removed from everywhere.
- Use `xpending(java.lang.String, java.lang.String, redis.clients.jedis.params.XPendingParams)` instead.
- `getArgs()` and `limit(Limit limit)` methods have been removed from `Group` class.

- `xpending(byte[] key, byte[] groupName, byte[] start, byte[] end, int count, byte[] consumerName)` method has been removed from everywhere.
- Use `xpending(byte[], byte[], redis.clients.jedis.params.XPendingParams)` instead.
- `addCommandEncodedArguments` and `addCommandBinaryArguments` methods have been removed from `FieldName` class.

- `topkCount(String key, String... items)` method has been removed from everywhere.
- `addObjects(int[] ints)` method has been removed from `CommandArguments`.

- Following methods have been removed:
- `strAlgoLCSStrings(String strA, String strB, StrAlgoLCSParams params)`
- `strAlgoLCSStrings(byte[] strA, byte[] strB, StrAlgoLCSParams params)`
- `strAlgoLCSKeys(String keyA, String keyB, StrAlgoLCSParams params)`
- `strAlgoLCSKeys(byte[] keyA, byte[] keyB, StrAlgoLCSParams params)`

- `StrAlgoLCSParams` has been removed.
- `StrAlgoLCSParams` class has been removed.

- Following methods have been removed from all Pipeline classes:
- `ftCursorRead(String indexName, long cursorId, int count)`
Expand All @@ -147,14 +153,6 @@
- `ftAliasUpdate(String aliasName, String indexName)`
- `ftAliasDel(String aliasName)`

- `addObjects(int[] ints)` method has been removed from `CommandArguments`.

- `getArgsString()` and `serializeRedisArgs(List<byte[]> redisArgs)` methods have been removed from `AggregationBuilder`.

- `totalResults` variable in `AggregationResult` has been made private. Use `getTotalResults()` method instead.

- `retentionTime(long retentionTime)` method in `TSAlterParams` has been removed. Use `retention(long)` method instead.

- `JedisSentineled(String masterName, Set<HostAndPort> sentinels, JedisClientConfig masterClientConfig, JedisClientConfig sentinelClientConfig)` and
`JedisSentineled(String masterName, Set<HostAndPort> sentinels, GenericObjectPoolConfig<Connection> poolConfig, JedisClientConfig masterClientConfig, JedisClientConfig sentinelClientConfig)`
constructors have been removed.
Expand Down
4 changes: 2 additions & 2 deletions docs/jedis-maven.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>4.3.0</version>
<version>5.0.0</version>
</dependency>
```

Expand All @@ -28,7 +28,7 @@ and
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>4.4.0-SNAPSHOT</version>
<version>5.1.0-SNAPSHOT</version>
</dependency>
</dependencies>
```
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<packaging>jar</packaging>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>5.0.0-SNAPSHOT</version>
<version>5.1.0-SNAPSHOT</version>
<name>Jedis</name>
<description>Jedis is a blazingly small and sane Redis java client.</description>
<url>https://github.com/redis/jedis</url>
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/redis/clients/jedis/JedisSentineled.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,9 @@ public JedisSentineled(SentineledConnectionProvider sentineledConnectionProvider
public HostAndPort getCurrentMaster() {
return ((SentineledConnectionProvider) provider).getCurrentMaster();
}

@Override
public Pipeline pipelined() {
return (Pipeline) super.pipelined();
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package redis.clients.jedis.exceptions;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import redis.clients.jedis.HostAndPort;
Expand All @@ -8,45 +9,22 @@
* Note: This exception extends {@link JedisDataException} just so existing applications catching
* JedisDataException do not get broken.
*/
// TODO: extends JedisException
public class JedisBroadcastException extends JedisDataException {

private static final String BROADCAST_ERROR_MESSAGE = "A failure occurred while broadcasting the command.";

private final Map<HostAndPort, SingleReply> replies = new HashMap<>();
private final Map<HostAndPort, Object> replies = new HashMap<>();

public JedisBroadcastException() {
super(BROADCAST_ERROR_MESSAGE);
}

public void addReply(HostAndPort node, Object reply) {
replies.put(node, new SingleReply(reply));
replies.put(node, reply);
}

public void addError(HostAndPort node, JedisDataException error) {
replies.put(node, new SingleReply(error));
}

public static class SingleReply {

private final Object reply;
private final JedisDataException error;

public SingleReply(Object reply) {
this.reply = reply;
this.error = null;
}

public SingleReply(JedisDataException error) {
this.reply = null;
this.error = error;
}

public Object getReply() {
return reply;
}

public JedisDataException getError() {
return error;
}
public Map<HostAndPort, Object> getReplies() {
return Collections.unmodifiableMap(replies);
}
}

0 comments on commit fd56dda

Please sign in to comment.