Jedis is a synchronous Java client for Redis, shipped as a library on Maven Central as redis.clients:jedis.
It covers standalone, cluster, sentinel, and multi-db setups — with pipelining, transactions, pub/sub, and Redis Stack modules — and targets Java 8 for source/binary compatibility.
- Maintain JDK 8 compatibility. All production and test code must compile and run on JDK 8.
- Keep documentation up to date. If a change affects user-facing behavior, configuration, or the public API, update the relevant pages under
docs/(MkDocs). - Add or update tests. Every bug fix should include a regression test, and every new feature should include appropriate tests. Follow the conventions in
docs/integration-testing.mdfor choosing between unit and integration tests. - Document breaking changes. Any breaking change must be documented in the appropriate migration guide under
docs/migration-guides/. - Follow the contribution guidelines. Ensure all changes comply with the project rules in
.github/CONTRIBUTING.md. - Request approval before adding dependencies. Do not introduce new runtime, test, or build dependencies without explicit confirmation.
- Review-friendly changes. Keep commits and pull requests focused and logically grouped. Separate feature or bug-fix changes from refactoring, formatting, and other mechanical changes whenever practical.
- Use the CI JDK version. Build and test using the same JDK version configured in the GitHub Actions workflows. Check
.github/workflows/(ordocs/integration-testing.md) to determine the required version before reproducing CI failures.
make start version=8.6+mvn clean verify+make stop— full run against the Docker Redis env (make testdoes all three).mvn test— unit tests (no Redis);mvn -Dtest=ClassName testfor one class.
- Keep comments short and informative. Comment why, not what. Avoid comments that simply restate the code.
- Remove unused imports. Do not use wildcard imports. Avoid fully qualified class names unless necessary to resolve naming conflicts.
- Annotate all new public API with
@since. Determine the version from the current build by running:(or by reading the top-levelmvn help:evaluate -Dexpression=project.version -q -DforceStdout
<version>inpom.xml), then remove the-SNAPSHOTsuffix. For example,8.0.0-SNAPSHOTbecomes@since 8.0.
- Name new unit test classes using the
*Testconvention. - Name new integration test classes using the
*ITconvention. Do not use theintegrationtag for new tests.
See docs/redis-client-components-overview.md
for a high-level walkthrough (executors, providers, builders, and command execution flows).
UnifiedJedis is the core client. It implements the command interfaces and
delegates to three collaborators:
ConnectionProvider(providers/) — obtains connections: pooled, cluster, sentinel, or multi-db.CommandExecutor(executors/) — runs a command: simple, retry, cluster routing, or failover.CommandObjects— factory building a typedCommandObject<T>per command.
Modern clients extend UnifiedJedis and are built through
AbstractClientBuilder subclasses (builders/): RedisClient,
RedisClusterClient, RedisSentinelClient, MultiDbClient. A new client
overrides createDefaultConnectionProvider(), createDefaultCommandExecutor(),
createClient(), and validateSpecificConfiguration() (run before build()).
Legacy client: Jedis is the single-connection client (pooling via
JedisPool), still supported. JedisPool, JedisCluster, and
JedisSentinelPool are @Deprecated in favor of the builder-based clients.
Feature modules expose dedicated command interfaces under
redis.clients.jedis.<module>: search, json, bloom, timeseries, plus
csc (client-side caching) and mcf (multi-db / failover).
Adding or changing a command — trace an existing command first, then update the full matrix so all surfaces stay in sync:
- Command interfaces (
commands/):<Group>Commandsand<Group>BinaryCommands(String vsbyte[]), each with its<Group>Pipeline…variant. CommandObjects— build the args and a responseBuilder<T>, e.g.new CommandObject<>(commandArguments(GET).key(key), BuilderFactory.STRING).ClusterCommandObjectsoverrides these to enforce cluster constraints.UnifiedJedisandPipeliningBase— the execution entry points.Jedis— add it here too, for backward compatibility.
Encoding:
- String ↔ bytes:
SafeEncoder.encode()— neverString.getBytes()(breaks GBK). - Numeric → bytes:
Protocol.toByteArray().