Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Scalable Java Redis client
tag: 1.1.0

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.


lettuce - A scalable Java Redis client

  Lettuce is a scalable thread-safe Redis client. Multiple threads may share one
  RedisConnection provided they avoid blocking and transactional operations such
  as BLPOP, and MULTI/EXEC. Multiple connections are efficiently managed by the
  excellent netty NIO framework.

  This version of lettuce has been tested against redis 2.4.2

Basic Usage

  RedisClient client = new RedisClient("localhost")
  RedisConnection<String, String> connection = client.connect()
  String value = connection.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.


  RedisPubSubConnection<String, String> connection = client.connectPubSub()
  connection.addListener(new RedisPubSubListener<String>() { ... })


  RedisAsyncConnection<String, String> async = connection.getAsyncConnection()
  async.set("key", "value")
  List<Object> results = async.flush()

  When using an async connection all redis commands except for multi, exec,
  and discard will immediately return null. Calling flush() will wait for all
  commands to complete and then return their outputs.

  Async connections are just a lightweight wrapper around a regular connection
  and the same restrictions on blocking and transactional operations apply.
  The wrapper is not thread-safe and should only be used by a single thread.


  Lettuce supports pluggable codecs responsible for encoding and decoding keys
  and values. The default codec supports UTF-8 encoded String keys and values.

  Each connection may have its own codec passed to the extended
  RedisClient.connect method:

  RedisConnection<K, V> connect(RedisCodec<K, V> codec)

Maven Artifacts

  Releases of lettuce are available in the maven central repository.

Something went wrong with that request. Please try again.