Awesome Open Source
Awesome Open Source

Lettuce - Advanced Java Redis client

Maven Central

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.

See the reference documentation and Wiki for more details.




Binaries and dependency information for Maven, Ivy, Gradle and others can be found at

Releases of lettuce are available in the Maven Central repository. Take also a look at the Releases.

Example for Maven:


If you'd rather like the latest snapshots of the upcoming major version, use our Maven snapshot repository and declare the appropriate dependency version.


    <name>Sonatype Snapshot Repository</name>

Basic Usage

RedisClient client = RedisClient.create("redis://localhost");
StatefulRedisConnection<String, String> 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

StatefulRedisConnection<String, String> connection = client.connect();
RedisStringAsyncCommands<String, String> async = connection.async();
RedisFuture<String> set = async.set("key", "value")
RedisFuture<String> get = async.get("key")

async.awaitAll(set, get) == true

set.get() == "OK"
get.get() == "value"

See Asynchronous API for further details.

Reactive API

StatefulRedisConnection<String, String> connection = client.connect();
RedisStringReactiveCommands<String, String> reactive = connection.reactive();
Mono<String> set = reactive.set("key", "value");
Mono<String> get = reactive.get("key");


get.block() == "value"

See Reactive API for further details.


RedisPubSubCommands<String, String> connection = client.connectPubSub().sync();
connection.getStatefulConnection().addListener(new RedisPubSubListener<String, String>() { ... })

Cloud Provider Compatibility

While we're not actively testing Lettuce against various cloud offerings, we've verified initial compatibility with the following services (or have seen folks using Lettuce there):

  • AWS Elasticache (Operated in replica- and Redis Cluster mode)
  • Azure Redis
  • IBM Cloud Databases for Redis
  • Google Cloud Memorystore for Redis
  • RedisLabs Enterprise Redis Cluster

Note: Some providers operate Redis in non-standard modes that aren't fully supported by Lettuce.


Lettuce is built with Apache Maven. The tests require multiple running Redis instances for different test cases which are configured using a Makefile. Tests run by default against Redis unstable.

To build:

$ git clone
$ cd lettuce/
$ make prepare ssl-keys
$ make test
  • Initial environment setup (clone and build redis): make prepare
  • Setup SSL Keys: make ssl-keys
  • Run the build: make test
  • Start Redis (manually): make start
  • Stop Redis (manually): make stop

Bugs and Feedback

For bugs, questions and discussions please use the GitHub Issues.



Github is for social coding: if you want to write code, I encourage contributions through pull requests from forks of this repository. Create Github tickets for bugs and new features and comment on the ones that you are interested in and take a look into

Alternative Project Comparisons
Related Awesome Lists
Top Programming Languages

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
Java (412,144
Redis (24,275
Reactive (5,614
Redis Client (670
Redis Cluster (335
Redis Sentinel (164
Aws Elasticache (22
Azure Redis Cache (7