+0
Daily
5,786
stars
1,123
forks
195
watchers
1,071
prs
2,620
issues
165
releases
README
Lettuce - Advanced Java Redis client
===============================
Lettuce is a scalable thread-safe Redis client for synchronous,
asynchronous and reactive usage. Multiple threads may share one connection if they avoid blocking and transactional
operations such as BLPOP and MULTI/EXEC.
Lettuce is built with netty.
Supports advanced Redis features such as Sentinel, Cluster, Pipelining, Auto-Reconnect and Redis data models.
This version of Lettuce has been tested against the latest Redis source-build.
synchronous, asynchronous and reactive usage
Redis Sentinel
Redis Cluster
SSL and Unix Domain Socket connections
Streaming API
Codecs (for UTF8/bit/JSON etc. representation of your data)
multiple Command Interfaces
Support for Native Transports
Support RediSearch, RedisJSON and Redis Vector Sets
Compatible with Java 8++ (implicit automatic module w/o descriptors)
See the reference documentation and API Reference for more details.
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
Documentation
---------------
Reference documentation
Javadoc
Binaries/Download
----------------
Binaries and dependency information for Maven, Ivy, Gradle and others can be found at http://search.maven.org.
Releases of lettuce are available in the Maven Central repository. Take also a look at the Releases.
Example for Maven:
xml
io.lettuce
lettuce-core
x.y.z
If you'd rather like the latest snapshots of the upcoming major version, use our Maven snapshot repository and declare the appropriate dependency version.
xml
io.lettuce
lettuce-core
x.y.z.BUILD-SNAPSHOT
sonatype-snapshots
Sonatype Snapshot Repository
https://oss.sonatype.org/content/repositories/snapshots/
true
Basic Usage
-----------
java
RedisClient client = RedisClient.create("redis://localhost");
StatefulRedisConnection connection = client.connect();
RedisStringCommands sync = connection.sync();
String value = sync.get("key");
Each Redis command is implemented by one or more methods with names identical
to the lowercase Redis command name. Complex commands with multiple modifiers
that change the result type include the CamelCased modifier as part of the
command name, e.g. zrangebyscore and zrangebyscoreWithScores.
See Basic usage for further details.
Asynchronous API
------------------------
java
StatefulRedisConnection connection = client.connect();
RedisStringAsyncCommands async = connection.async();
RedisFuture set = async.set("key", "value");
RedisFuture get = async.get("key");
LettuceFutures.awaitAll(set, get) == true
set.get() == "OK"
get.get() == "value"
See Asynchronous API for further details.
Reactive API
------------------------
java
StatefulRedisConnection connection = client.connect();
RedisStringReactiveCommands reactive = connection.reactive();
Mono set = reactive.set("key", "value");
Mono get = Top issues
#338Re-establish connections in the case of Master/Slave failover39 comments · 2016-08-19#1111Race condition when using pipelining in cluster mode21 comments · 2019-08-29#3287Undefined results when using ReadFrom with SCAN family commands18 comments · 2025-05-06#1380Investigate for Client-side caching using Redis Cluster and Master/Replica18 comments · 2020-08-06#1530CircuitBreaker17 comments · 2020-11-24#1293Not able to read the updated Master when connected Master/Slave through sentinel16 comments · 2020-05-22#2488Retry commands failed with `LOADING` against the master node14 comments · 2023-08-16#2420Commands on newly created connections remain un-flushed13 comments · 2023-06-08
Discussions
#3912Should `dynamicRefreshSources=true` still query newly discovered nodes in the same refresh?1 comments · 2026-09-13#3890READONLY init uses ForkJoinPool.commonPool(); blocked common pool causes replica-read timeouts1 comments · 2026-08-14#3473AWS Elasticache IAM Auth - Connections Fail on Token Expiration3 comments · 2025-10-08#3373Lettuce failed to reconnect when connection is broken1 comments · 2025-07-29#3362Request Hedging, slow start2 comments · 2025-07-17#3327does Lettuce allow duplicate field when using the XADD command?2 comments · 2025-06-17#3310Kotlin Multiplatform1 comments · 2025-05-27#3284AWS Elasticache: Lettuce ROLE to master node fails and connection to primary never gets established.3 comments · 2025-05-02
Latest release
7.9.0.RELEASE 7.9.0.RELEASE 2026-10-14The Lettuce team is pleased to announce the Lettuce 7.9.0 minor release! Lettuce 7.9.0 supports Redis 2.6+ up to Redis 8.x. In terms of Java runtime, Lettuce requires at least Java 8 and works with Java 24. The driver is tested against Redis 8.10, Redis 8.8, Redis 8.6, Redis 8.4, Redis 8.2, Redis 8.0, Redis 7.4 and Redis 7.2. Thanks to all contributors who made Lettuce 7.9.0.RELEASE possible. 📗 Links Reference documentation: https://lettuce.io/core/7.9.0.RELEASE 🐞 Bug Fixes Fix GEODIST destination argument validation by @codingkiddo in https://github.com/redis/lettuce/pull/3934