jedis README

The project's README from github.com/redis/jedis. As one markdown file: README.md.

Jedis

Release Maven Central Javadocs MIT licensed codecov Discord

What is Jedis?

Jedis is a Java client for Redis designed for performance and ease of use.

Are you looking for a high-level library to handle object mapping? See redis-om-spring!

How do I Redis?

Learn for free at Redis University

Try the Redis Cloud

Dive in developer tutorials

Join the Redis community

Work at Redis

Supported Redis versions

The most recent version of this library supports redis version 7.2, 7.4, 8.0, 8.2, 8.4, 8.6, 8.8 and 8.10.

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.

Jedis version Supported Redis versions JDK Compatibility
3.9+ 5.0 to 6.2 Family of releases 8, 11
>= 4.0 Version 5.0 to 7.2 Family of releases 8, 11, 17
>= 5.0 Version 6.0 to current 8, 11, 17, 21
>= 5.2 Version 7.2 to current 8, 11, 17, 21
>= 6.0 Version 7.2 to current 8, 11, 17, 21
>= 7.0 Version 7.2 to current 8, 11, 17, 21
>= 8.0 Version 7.2 to current 8, 11, 17, 21, 25

Getting started

To get started with Jedis, first add it as a dependency in your Java project. If you're using Maven, that looks like this:

<dependency>
    <groupId>redis.clients</groupId>
    <artifactId>jedis</artifactId>
    <version>8.0.1</version>
</dependency>

To use the cutting-edge Jedis, check here.

Next, you'll need to connect to Redis. Consider installing a redis server with docker:

docker run -p 6379:6379 -it redis:latest

You can instantiate a RedisClient like so:

RedisClient jedis = RedisClient.builder().hostAndPort("localhost", 6379).build();

Now you can send commands:

jedis.sadd("planets", "Venus");

Connecting to a Redis cluster

Jedis lets you connect to Redis Clusters, supporting the Redis Cluster Specification. To do this, you'll need to connect using RedisClusterClient. See the example below:

Set<HostAndPort> jedisClusterNodes = new HashSet<HostAndPort>();
jedisClusterNodes.add(new HostAndPort("127.0.0.1", 7379));
jedisClusterNodes.add(new HostAndPort("127.0.0.1", 7380));
RedisClusterClient jedis = RedisClusterClient.builder().nodes(jedisClusterNodes).build();

Now you can use the RedisClusterClient instance and send commands like you would with a standard pooled connection:

jedis.sadd("planets", "Mars");

Support for Redis data types

Jedis includes support for all Redis data types and features such as JSON and VectorSets.

Failover

Jedis supports retry and failover for your Redis deployments. This is useful when:

  1. You have more than one Redis deployment. This might include two independent Redis servers or two or more Redis databases replicated across multiple active-active Redis Enterprise clusters.
  2. You want your application to connect to one deployment at a time and to fail over to the next available deployment if the first deployment becomes unavailable.

For the complete failover configuration options and examples, see the Jedis failover docs.

Token-Based Authentication

Jedis supports Token-Based authentication (TBA) starting with 5.3.0 GA release. This feature is complemented by an extension library that enhances the developer experience and provides most of the components required for TBA functionality.

Notably, the extension library includes built-in support for Microsoft EntraID, offering a seamless integration as part of the generic solution.

For more details and examples, please refer to the Advanced Usage documentation.

Documentation

The Jedis documentation site contains several useful articles for using Jedis.

You can also check the latest Jedis Javadocs.

Some specific use-case examples can be found in redis.clients.jedis.examples package of the test source codes.

Troubleshooting

If you run into trouble or have any questions, we're here to help!

Hit us up on the Redis Discord Server or Jedis GitHub Discussions.

Contributing

We'd love your contributions!

Bug reports are always welcome! You can open a bug report on GitHub.

To report a security vulnerability, please follow our Security Policy.

You can also contribute documentation -- or anything to improve Jedis. Please see contribution guideline for more details.

License

Jedis is licensed under the MIT license.

Sponsorship

Redis Logo

jedis (redis/jedis)

Searching Database…

12.4K ·GitHub
What is this?Jedis is a Java client library for Redis, built for performance and ease of use so Java applications can talk to Redis servers, clusters, or Redis Enterprise deployments.
Is it a full ORM or a thin client?It's a low-level client that sends Redis commands directly. If you want object mapping on top of Redis, the README points you to a separate project, redis-om-spring.
How do I add Jedis to my project?Add Jedis as a Maven dependency, then connect to a Redis server (you can spin one up quickly with Docker) and instantiate a RedisClient to start sending commands.
Which Redis and JDK versions does it support?Current Jedis supports Redis 7.2 through 8.10, and JDK 8, 11, 17, 21, or 25 depending on the Jedis version used.
Does it handle Redis cluster and failover setups out of the box?Yes — Jedis has a dedicated RedisClusterClient for Redis Cluster Specification deployments, and built-in retry/failover support for multi-deployment or active-active Redis Enterprise setups.
Does Jedis support JSON and vector data types?Yes, Jedis includes support for all Redis data types and features such as JSON and VectorSets.
Is token-based authentication supported?Yes, since the 5.3.0 GA release Jedis supports Token-Based Authentication (TBA), including built-in support for Microsoft EntraID via an extension library.
Creator
redis
Size
19.3 MB
Stars
12.4K
Age
16y
Commits · 90 Days