feat: Value Commands for Lettuce backend#4
Open
vchomakov wants to merge 2 commits into
Open
Conversation
Dgramada
reviewed
Jun 17, 2026
25d3e35 to
8b6ecd1
Compare
Implements reactive and blocking Value Commands (GET/SET/INCR/DECR/MGET/MSET/APPEND/STRLEN/GETEX/GETDEL/GETRANGE/SETRANGE/...) on the Lettuce backend via the proxy infrastructure. - AbstractLettuceCommands: shared base for Lettuce reactive command groups - LettuceReactiveValueCommandsImpl: async Lettuce -> Mutiny Uni adaptation - LettuceBlockingValueCommandsImpl: wraps the reactive impl with timeout - LettuceValueCommandsConverters: SetArgs / GetExArgs -> Lettuce equivalents, registered with LettuceConverterRegistry on first use LCS / LCSLEN: not supported on Lettuce 6.5.x (only exposes the deprecated STRALGO form, removed in Redis 7.0); enabled with the Lettuce 7 upgrade. Tests: 16 converter unit tests + 16 integration tests against Redis 7.
- Register argument converters in a static initializer instead of a volatile flag with double-checked locking; register() remains as an explicit class-initialization trigger. - Rework the SetArgs/GetExArgs token loops to arrow-style switches over an iterator, with a helper that consumes and validates keyword values, replacing the tokens.get(++i) side effect. - Hardcode the "map" parameter name in requireNonEmpty and drop the redundant @SuppressWarnings("deprecation") on getset.
2159dca to
020084c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the
ValueCommands/ReactiveValueCommandsimplementation on the Lettuce backend, building on the proxy infrastructure already in place.This is the first command group to land on Lettuce. The patterns established here — converter registry usage, reactive-to-async bridging via
LettuceResult.toUni, blocking-over-reactive timeout wrapping — will be reused by every subsequent command group (Hash, List, Set, SortedSet, …).What's included
Production code
AbstractLettuceCommands<K, V>— shared base class for Lettuce-backed reactive command groups. Holds theRedisAsyncCommands<K, V>handle obtained fromStatefulRedisConnection#async(). Mirrors the role ofAbstractRedisCommandson the Vert.x side.LettuceReactiveValueCommandsImpl<K, V>— implements all 27 methods ofReactiveValueCommands<K, V>. Each method validates arguments, looks up any structured argument converter inLettuceConverterRegistry, invokes the matching Lettuce async command, and adapts the resultingCompletionStage<T>toUni<T>. Registers the Value-Commands converters in a static initializer on first class load.LettuceBlockingValueCommandsImpl<K, V>— implementsValueCommands<K, V>by delegating to the reactive impl and awaiting each result with.await().atMost(timeout). ParallelsBlockingStringCommandsImplon the Vert.x side.LettuceValueCommandsConverters— translates QuarkusSetArgs/GetExArgsto their Lettuce counterparts. Parses the wire-format token list returned bytoArgs()(the Quarkus arg classes expose no getters). Self-registers withLettuceConverterRegistryvia an idempotent, thread-saferegister().Tests
LettuceValueCommandsConvertersTest— 16 pure-JVM unit tests. For eachSetArgs/GetExArgsflag combination (EX, EXAT, PX, PXAT, NX, XX, KEEPTTL, GET, PERSIST, combined, empty), builds the Quarkus object, converts it, renders the Lettuce args to wire tokens viaCommandArgs#toCommandString(), and asserts they match the original QuarkustoArgs()output. Verifies semantic round-trip without needing a Redis instance.LettuceValueCommandsIntegrationTest— 16 tests against a real Redis 7 container via Testcontainers. Exercises both reactive and blocking implementations end-to-end:null) / MSET / MSETNX (all-or-nothing semantics)getDataSource()accessor pass-throughEach test calls
flushdb()in@BeforeEachfor isolation.Notes on
LCS/lcsLengthLettuce 6.5.x exposes only
stralgoLcs, which emits the deprecatedSTRALGO LCScommand — removed in Redis 7.0. Rather than shipping a broken code path, both methods fail with a clearUnsupportedOperationException:When the Lettuce 7 upgrade lands, enabling LCS is a mechanical one-line replacement in each method; the helper constructing this exception gets deleted. Two integration tests lock in the current behavior.
Out of scope
@Inject RedisDataSource/@Inject ReactiveRedisDataSource— backend selection is a separate follow-up PRVerification
extensions/redis-client/runtimefull test suite — all tests passing, no regressionsDependency chain
This branch depends on the proxy infrastructure branch (
lettuce-proxy-infrastructure). Once that merges, this rebases cleanly on top.