What Is New in Jedis 4.4
Jedis 4.4 brings key enhancements focused on new Redis commands, improved connection handling, and essential bug fixes. This update keeps the client aligned with the latest Redis server capabilities.
| Category | Key Changes |
|---|---|
| New Features | Support for ACL DRYRUN, CLIENT NO-TOUCH, and other new Redis commands. |
| Improvements | Connection pool validation and more flexible connection creation. |
| Bug Fixes | Addresses issues with connection leaks and cluster command routing. |
| Deprecated | Methods related to the deprecated WAIT command overload. |
What new Redis commands does Jedis 4.4 support?
Jedis 4.4 adds support for several new Redis commands, expanding its coverage of the Redis API. This includes security, client management, and set command enhancements.
The update introduces aclDryRun() for testing ACL permissions and clientNoTouch() to prevent updating the client's last interaction time. It also includes support for SMISMEMBER for checking multiple set members and ZINTERCARD/ZUNIONCARD for sorted set intersection/union counts.
How are connection pools improved in this version?
Connection pool behavior has been made more robust with the addition of a testOnCreate parameter. This allows for immediate validation of new connections when they are added to the pool, helping to catch configuration issues early.
Furthermore, the JedisPooled constructor now accepts a HostAndPortMapper. This provides greater flexibility for scenarios where you need to dynamically map connection endpoints, such as in cloud environments.
What critical bugs were fixed in Jedis 4.4?
This release patches a significant connection leak that could occur when using JedisCluster with a custom HostAndPortMapper. Connections were not being properly returned to the pool, leading to potential resource exhaustion.
Another fix resolves a routing issue for the RENAMENX command in cluster mode. The command now correctly handles cross-slot key operations by throwing the proper JedisClusterOperationException instead of failing silently or incorrectly.
Is anything being deprecated in this release?
Yes, Jedis 4.4 has deprecated the waitReplicas method that accepted a timeout and replicas parameter. This follows the deprecation of the same command overload in Redis server itself.
You should migrate to using the waitReplicas method that only requires a replicas parameter. The deprecated method will be removed in a future major version.
FAQ
Should I be concerned about the connection leak fix?
Yes, if you use JedisCluster with a custom HostAndPortMapper. This leak could gradually consume all available connections, so upgrading to 4.4 is recommended to prevent this issue.
How do I use the new ACL DRYRUN command?
Use the aclDryRun(user, command) method on your Jedis instance. It returns whether the specified user is allowed to execute the given command, which is great for testing ACL rules without actual execution.
What's the benefit of the testOnCreate pool option?
It helps catch authentication or network configuration errors immediately when a connection is created, rather than when it's first borrowed from the pool. This makes debugging connection issues faster and more straightforward.
Does the ZINTERCARD command work in Redis cluster mode?
Yes, but like all multi-key commands in cluster mode, all keys must hash to the same slot. If they don't, you'll get a JedisClusterOperationException.
Is this release backwards compatible?
Mostly yes, it's a minor version. The main change to be aware of is the deprecation of the waitReplicas method overload, which will require a code change eventually but not immediately.