Choosing Lettuce or Redisson
Latest stable Based on Bluetape4k release 1.11.0
Choose the abstraction, not the library name
Section titled “Choose the abstraction, not the library name”Both clients connect to Redis, but their primary abstractions differ. Decide whether the application wants to compose Redis commands directly or use higher-level distributed objects with their own lifecycle.
| Requirement | Lettuce | Redisson |
|---|---|---|
| Sync/async commands and pipelines | Primary path | Available, but not the focus of these helpers |
| Awaiting futures in coroutines | awaitSuspending, coroutine commands | RFuture adapters and suspended batch/transactions |
| Object codecs | Binary, JSON, and Protobuf codecs | JSON, Fory, and compressed codecs |
| Distributed locks, maps, and queues | Design with raw commands | Redisson distributed objects |
| Stream consumer-group helpers | Build with command APIs | Validated RStreamSupport helpers |
| Local cached maps | Check the 1.11.0 loaded-map limits | Near Cache over RLocalCachedMap |
Choose Lettuce for command-oriented code
Section titled “Choose Lettuce for command-oriented code”Lettuce is a direct fit when Redis commands, pipelines, and explicit key design are central to the service. LettuceClients supplies client and command entry points, while RedisFutureSupport bridges futures to suspending calls.
A coroutine adapter does not turn the Redis operation into a cancellable transaction. Assign connection ownership, timeouts, and reconnect behavior first in Clients and connections.
Choose Redisson for distributed objects
Section titled “Choose Redisson for distributed objects”Redisson fits distributed locks, maps, Streams, batch and transactions, or local cached maps. The redissonClient {} DSL reduces setup, but the application still owns and shuts down the returned client.
Near Cache is not just a faster-map switch. Pub/Sub invalidation, reconnect behavior, Codec compatibility, and cache names are operational contracts. See Local cached maps and invalidation.
Use both only with explicit boundaries
Section titled “Use both only with explicit boundaries”A service may use Lettuce commands and a Redisson lock together. It then owns two client pools, retry policies, timeouts, and shutdown paths. If both clients share a keyspace, test the exact Codec bytes rather than assuming compatibility.
Cross-client failure fallback is risky. A command can succeed at the server before the first client reports a timeout, and the second client can execute it again. Do not add automatic fallback without idempotency and result-reconciliation rules.
Continue from the decision
Section titled “Continue from the decision”- For Lettuce, continue to Commands and coroutines.
- For Redisson, start with Clients, distributed objects, and Streams.
- To remove one client from an existing umbrella consumer, follow Selective dependency migration.