Skip to content

Commit 297279e

Browse files
uglideCopilot
andauthored
Add v6 and v7 migration guides (#4315)
* Add migration guide for v7 * Move all migration guides to subfolder * Update readme: - Bump client version - Update list of supported Redis versions - Remove references to JedisPool - Remove reference to Google Group * Remove duplicated content in the migration guide * Update README.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Add missing v5 to v6 migration guide * Fix broken link * Update outdated modules section in README --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 3645601 commit 297279e

File tree

8 files changed

+524
-44
lines changed

8 files changed

+524
-44
lines changed

README.md

Lines changed: 10 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@ Are you looking for a high-level library to handle object mapping? See [redis-om
3030
The most recent version of this library supports redis version
3131
[7.2](https://github.com/redis/redis/blob/7.2/00-RELEASENOTES),
3232
[7.4](https://github.com/redis/redis/blob/7.4/00-RELEASENOTES),
33-
[8.0](https://github.com/redis/redis/blob/8.0/00-RELEASENOTES) and
34-
[8.2](https://github.com/redis/redis/blob/8.2/00-RELEASENOTES).
33+
[8.0](https://github.com/redis/redis/blob/8.0/00-RELEASENOTES),
34+
[8.2](https://github.com/redis/redis/blob/8.2/00-RELEASENOTES) and
35+
[8.4](https://github.com/redis/redis/blob/8.4/00-RELEASENOTES).
3536

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

@@ -53,7 +54,7 @@ To get started with Jedis, first add it as a dependency in your Java project. If
5354
<dependency>
5455
<groupId>redis.clients</groupId>
5556
<artifactId>jedis</artifactId>
56-
<version>6.2.0</version>
57+
<version>7.0.0</version>
5758
</dependency>
5859
```
5960

@@ -65,37 +66,13 @@ Next, you'll need to connect to Redis. Consider installing a redis server with d
6566
docker run -p 6379:6379 -it redis:latest
6667
```
6768

68-
For many applications, it's best to use a connection pool. You can instantiate a Jedis connection pool like so:
69-
70-
```java
71-
JedisPool pool = new JedisPool("localhost", 6379);
72-
```
73-
74-
With a `JedisPool` instance, you can use a
75-
[try-with-resources](https://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html)
76-
block to get a connection and run Redis commands.
77-
78-
Here's how to run a single [SET](https://redis.io/commands/set) command within a *try-with-resources* block:
79-
80-
```java
81-
try (Jedis jedis = pool.getResource()) {
82-
jedis.set("clientName", "Jedis");
83-
}
84-
```
85-
86-
`Jedis` instances implement most Redis commands. See the
87-
[Jedis Javadocs](https://www.javadoc.io/doc/redis.clients/jedis/latest/redis/clients/jedis/Jedis.html)
88-
for the complete list of supported commands.
89-
90-
### Easier way of using connection pool
91-
92-
Using a *try-with-resources* block for each command may be cumbersome, so you may consider using JedisPooled.
69+
For many applications, it's best to use a connection pool. You can instantiate a JedisPooled like so:
9370

9471
```java
9572
JedisPooled jedis = new JedisPooled("localhost", 6379);
9673
```
9774

98-
Now you can send commands like sending from Jedis.
75+
Now you can send commands:
9976

10077
```java
10178
jedis.sadd("planets", "Venus");
@@ -119,12 +96,10 @@ Now you can use the `JedisCluster` instance and send commands like you would wit
11996
jedis.sadd("planets", "Mars");
12097
```
12198

122-
## Using Redis modules
123-
124-
Jedis includes support for [Redis modules](https://redis.io/docs/modules/) such as
125-
[RedisJSON](https://redis.io/json/) and [RediSearch](https://redis.io/search/).
99+
## Support for Redis data types
126100

127-
See the [RedisJSON Jedis](https://redis.github.io/jedis/redisjson/) or [RediSearch Jedis](https://redis.github.io/jedis/redisearch/) for details.
101+
Jedis includes support for all [Redis data types](https://redis.io/docs/latest/develop/data-types/) and features such as
102+
[JSON](https://redis.io/docs/latest/develop/data-types/json/) and [VectorSets](https://redis.io/docs/latest/develop/data-types/vector-sets/).
128103

129104
## Failover
130105

@@ -157,8 +132,7 @@ package](https://github.com/redis/jedis/tree/master/src/test/java/redis/clients/
157132
If you run into trouble or have any questions, we're here to help!
158133

159134
Hit us up on the [Redis Discord Server](http://discord.gg/redis) or
160-
[Jedis GitHub Discussions](https://github.com/redis/jedis/discussions) or
161-
[Jedis mailing list](http://groups.google.com/group/jedis_redis).
135+
[Jedis GitHub Discussions](https://github.com/redis/jedis/discussions).
162136

163137
## Contributing
164138

File renamed without changes.
File renamed without changes.

docs/3to4.md renamed to docs/migration-guides/v3-to-v4.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ connection would go into an unusable state.
4040
- `JedisExhaustedPoolException` has been removed. A `JedisException` with a similar message is thrown
4141
instead.
4242

43-
- [Many sorted set methods](3to4-zset-list.md) return a Java `List` instead of a
44-
`Set`. [See the complete list](3to4-zset-list.md).
43+
- [Many sorted set methods](v3-to-v4-zset-list.md) return a Java `List` instead of a
44+
`Set`. [See the complete list](v3-to-v4-zset-list.md).
4545

46-
- [Many methods return primitive values](3to4-primitives.md)) (`long`/`boolean`/`double` instead of
46+
- [Many methods return primitive values](v3-to-v4-primitives.md)) (`long`/`boolean`/`double` instead of
4747
`Long`/`Boolean`/
48-
`Double`). [See the complete list](3to4-primitives.md).
48+
`Double`). [See the complete list](v3-to-v4-primitives.md).
4949

5050
- `scriptExists(byte[])` method now returns `Boolean` instead of `Long`.
5151

File renamed without changes.

docs/migration-guides/v5-to-v6.md

Lines changed: 261 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,261 @@
1+
# Jedis 6.0.0 Migration Guide
2+
3+
This guide helps you migrate from Jedis 5.x to Jedis 6.0.0. Version 6.0.0 includes breaking changes focused on Redis 8.0 support, removal of deprecated modules, and improvements to the Search API.
4+
5+
## Table of Contents
6+
7+
- [Overview](#overview)
8+
- [Breaking Changes](#breaking-changes)
9+
- [Removed RedisGraph Support](#removed-redisgraph-support)
10+
- [Removed Triggers and Functions (RedisGears v2)](#removed-triggers-and-functions-redisgears-v2)
11+
- [Search Dialect Default Change](#search-dialect-default-change)
12+
- [FT.PROFILE Return Type Change](#ftprofile-return-type-change)
13+
- [COMMAND INFO Response Changes](#command-info-response-changes)
14+
- [New Features](#new-features)
15+
- [Redis 8.0 Support](#redis-80-support)
16+
- [SslOptions for Advanced SSL Configuration](#ssloptions-for-advanced-ssl-configuration)
17+
- [Token-Based Authentication](#token-based-authentication)
18+
- [New Hash Commands](#new-hash-commands)
19+
- [Search Warning Messages](#search-warning-messages)
20+
- [Additional Resources](#additional-resources)
21+
22+
## Overview
23+
24+
Jedis 6.0.0 is a major release that adds Redis 8.0 support and removes deprecated features. The main focus areas are:
25+
26+
1. **Redis 8.0 compatibility** - Full support for Redis 8.0 features including built-in JSON, Search, and TimeSeries
27+
2. **Module deprecations** - Removal of RedisGraph and Triggers & Functions (RedisGears v2) support
28+
3. **Search API improvements** - Default dialect change and enhanced profiling responses
29+
4. **Security enhancements** - New SSL options and token-based authentication support
30+
31+
## Breaking Changes
32+
33+
### Removed RedisGraph Support
34+
35+
RedisGraph module support has been completely removed from Jedis 6.0.0 as the module has been deprecated by Redis.
36+
37+
#### Removed Classes and Interfaces
38+
39+
All classes in the `redis.clients.jedis.graph` package have been removed:
40+
41+
- `RedisGraphCommands` interface
42+
- `RedisGraphPipelineCommands` interface
43+
- `GraphCommandObjects` class
44+
- `GraphCache`, `GraphProtocol`, `GraphQueryParams` classes
45+
- `ResultSet`, `ResultSetBuilder`, `Record`, `Header`, `Statistics` classes
46+
- All entity classes: `Edge`, `Node`, `Path`, `Point`, `Property`, `GraphEntity`
47+
48+
### Removed Triggers and Functions (RedisGears v2)
49+
50+
Support for Triggers and Functions (RedisGears v2) has been removed from Jedis 6.0.0.
51+
52+
#### Removed Classes and Interfaces
53+
54+
All classes in the `redis.clients.jedis.gears` package have been removed:
55+
56+
- `RedisGearsCommands` interface
57+
- `RedisGearsProtocol` class
58+
- `TFunctionListParams`, `TFunctionLoadParams` classes
59+
- Response classes: `FunctionInfo`, `FunctionStreamInfo`, `GearsLibraryInfo`, `StreamTriggerInfo`, `TriggerInfo`
60+
61+
### Search Dialect Default Change
62+
63+
**BREAKING:** The default search dialect has changed from server-side default to **DIALECT 2** (client-side override).
64+
65+
#### Impact
66+
67+
Starting with Jedis 6.0.0, all `FT.SEARCH` and `FT.AGGREGATE` commands automatically append `DIALECT 2` unless explicitly configured otherwise. This may affect query results if you were relying on DIALECT 1 behavior.
68+
69+
#### Migration Path
70+
71+
**Option 1: Accept DIALECT 2 (Recommended)**
72+
73+
Review your search queries to ensure they work correctly with DIALECT 2. Most queries should work without changes.
74+
75+
**Option 2: Revert to DIALECT 1**
76+
77+
If you need to maintain DIALECT 1 behavior:
78+
79+
```java
80+
JedisPooled jedis = new JedisPooled("redis://localhost:6379");
81+
82+
// Set default dialect to 1
83+
jedis.setDefaultSearchDialect(1);
84+
85+
// Now all search commands will use DIALECT 1
86+
SearchResult result = jedis.ftSearch("idx:products", "@category:electronics");
87+
```
88+
89+
### FT.PROFILE Return Type Change
90+
91+
The return type of `FT.PROFILE` commands has changed from `Map<String, Object>` to a structured `ProfilingInfo` object.
92+
93+
#### Changed Methods
94+
95+
**Before (v5.x):**
96+
```java
97+
Map.Entry<SearchResult, Map<String, Object>> ftProfileSearch(
98+
String indexName, FTProfileParams profileParams, Query query);
99+
100+
Map.Entry<AggregationResult, Map<String, Object>> ftProfileAggregate(
101+
String indexName, FTProfileParams profileParams, AggregationBuilder aggr);
102+
```
103+
104+
**After (v6.0.0):**
105+
```java
106+
Map.Entry<SearchResult, ProfilingInfo> ftProfileSearch(
107+
String indexName, FTProfileParams profileParams, Query query);
108+
109+
Map.Entry<AggregationResult, ProfilingInfo> ftProfileAggregate(
110+
String indexName, FTProfileParams profileParams, AggregationBuilder aggr);
111+
```
112+
113+
### COMMAND INFO Response Changes
114+
115+
The response format for `COMMAND INFO` has been updated to include subcommand details, making it compatible with Redis 7.0+ and Redis 8.0.
116+
117+
#### Impact
118+
119+
If you were parsing the `COMMAND INFO` response, you may need to update your code to handle the new structure that includes subcommand information.
120+
121+
**Before (v5.x):**
122+
```java
123+
List<Object> commandInfo = jedis.commandInfo("SET");
124+
// Returns basic command information
125+
```
126+
127+
**After (v6.0.0):**
128+
```java
129+
List<Object> commandInfo = jedis.commandInfo("SET");
130+
// Returns command information including subcommand details
131+
// Compatible with Redis 7.0+ format
132+
```
133+
134+
## New Features
135+
136+
### Redis 8.0 Support
137+
138+
Jedis 6.0.0 adds full support for Redis 8.0, which includes built-in support for:
139+
140+
- **JSON** - Native JSON data type (previously RedisJSON module)
141+
- **Search and Query** - Full-text search capabilities (previously RediSearch module)
142+
- **TimeSeries** - Time-series data support (previously RedisTimeSeries module)
143+
144+
**Example:**
145+
```java
146+
JedisPooled jedis = new JedisPooled("redis://localhost:6379");
147+
148+
// JSON operations (built-in in Redis 8.0)
149+
jedis.jsonSet("user:1", Path2.of("$"), "{\"name\":\"John\",\"age\":30}");
150+
String json = jedis.jsonGet("user:1");
151+
152+
// Search operations (built-in in Redis 8.0)
153+
jedis.ftCreate("idx:users",
154+
FTCreateParams.createParams()
155+
.on(IndexDataType.JSON)
156+
.addPrefix("user:"),
157+
TextField.of("$.name").as("name"),
158+
NumericField.of("$.age").as("age"));
159+
160+
SearchResult result = jedis.ftSearch("idx:users", "@name:John");
161+
```
162+
163+
### SslOptions for Advanced SSL Configuration
164+
165+
A new `SslOptions` class provides advanced SSL/TLS configuration options for secure connections.
166+
167+
**Features:**
168+
- Custom keystore and truststore configuration
169+
- SSL protocol selection
170+
- SSL verification mode control
171+
- SSL parameters customization
172+
173+
**Example:**
174+
```java
175+
SslOptions sslOptions = SslOptions.builder()
176+
.keystore(new File("/path/to/keystore.jks"))
177+
.keystorePassword("keystorePassword".toCharArray())
178+
.truststore(new File("/path/to/truststore.jks"))
179+
.truststorePassword("truststorePassword".toCharArray())
180+
.sslVerifyMode(SslVerifyMode.FULL)
181+
.build();
182+
183+
JedisClientConfig config = DefaultJedisClientConfig.builder()
184+
.ssl(true)
185+
.sslOptions(sslOptions)
186+
.build();
187+
188+
JedisPooled jedis = new JedisPooled("localhost", 6379, config);
189+
```
190+
191+
### Token-Based Authentication
192+
193+
Jedis 6.0.0 introduces support for token-based authentication, useful for cloud environments and managed Redis services.
194+
195+
**Example:**
196+
```java
197+
// Token-based authentication with automatic token refresh
198+
TokenCredentials tokenCredentials = new TokenCredentials("initial-token");
199+
200+
JedisClientConfig config = DefaultJedisClientConfig.builder()
201+
.credentials(tokenCredentials)
202+
.build();
203+
204+
JedisPooled jedis = new JedisPooled("localhost", 6379, config);
205+
206+
// Token can be updated dynamically
207+
tokenCredentials.updateToken("new-token");
208+
```
209+
210+
### New Hash Commands
211+
212+
Support for new hash field expiration commands introduced in Redis 7.4:
213+
214+
- `HGETDEL` - Get and delete a hash field
215+
- `HGETEX` - Get a hash field with expiration options
216+
- `HSETEX` - Set a hash field with expiration
217+
218+
**Example:**
219+
```java
220+
// HSETEX - Set field with expiration
221+
jedis.hsetex("user:1", 3600, "session", "abc123");
222+
223+
// HGETEX - Get field and update expiration
224+
String session = jedis.hgetex("user:1", "session",
225+
HGetExParams.hgetExParams().ex(7200));
226+
227+
// HGETDEL - Get and delete field
228+
String oldSession = jedis.hgetdel("user:1", "session");
229+
```
230+
231+
### Search Warning Messages
232+
233+
Search and aggregation queries now support warning messages in results, helping identify potential issues with queries.
234+
235+
**Example:**
236+
```java
237+
SearchResult result = jedis.ftSearch("idx:products", "@name:laptop");
238+
239+
// Check for warnings
240+
if (result.hasWarnings()) {
241+
List<String> warnings = result.getWarnings();
242+
warnings.forEach(warning ->
243+
System.out.println("Search warning: " + warning));
244+
}
245+
```
246+
247+
## Additional Resources
248+
249+
- [Redis 8.0 Release Notes](https://github.com/redis/redis/blob/8.0/00-RELEASENOTES)
250+
- [Redis Search Documentation](https://redis.io/docs/interact/search-and-query/)
251+
- [Redis Query Dialects](https://redis.io/docs/interact/search-and-query/advanced-concepts/dialects/)
252+
253+
## Getting Help
254+
255+
If you encounter issues during migration:
256+
257+
1. Check the [Jedis GitHub Issues](https://github.com/redis/jedis/issues)
258+
2. Join the [Redis Discord](https://discord.gg/redis)
259+
3. Review the [Jedis Javadocs](https://www.javadoc.io/doc/redis.clients/jedis/latest/)
260+
4. Start a [Discussion](https://github.com/redis/jedis/discussions)
261+

0 commit comments

Comments
 (0)