You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add support for KeyValueOperations.findAllById(…) #655
Based on spring-projects/spring-data-redis#3150, we should introduce a new interface method returning multiple items by Id, something along the lines of KeyValueOperations.findAllById(Iterable<ID> ids, Class<T> type) and provide the necessary methods in KeyValueAdapter.
I'd like to take this one. I ran into it in production with @RedisHash repositories, where findAllById issues one HGETALL round trip per id, and we currently work around it with executePipelined, same as reported in spring-projects/spring-data-redis#3150.
getAll returns a list aligned with the given ids, with null for ids without a matching entry, so callers can correlate results with ids. KeyValueTemplate.findAllById uses that to keep publishing per-id beforeGet/afterGet events (batched: all beforeGet events before the lookup, then one afterGet per id). Store modules can override getAll with a batched implementation: a pipelined HGETALL in RedisKeyValueAdapter for spring-projects/spring-data-redis#3150, which I'd submit as a follow-up PR there.
One deliberate choice: a new method name instead of overloading get. An overload get(Iterable, String, Class) shifts overload resolution for existing untyped calls: when(mock.get(any(), anyString(), any())) in MapRepositoriesConfigurationExtensionIntegrationTests silently binds to the new method, and third-party code stubbing or calling KeyValueAdapter the same way would break identically.
SimpleKeyValueRepository.findAllById then delegates to KeyValueOperations.findAllById instead of looping findById.
I have this implemented locally with unit and integration tests, but wanted to check the API shape here before opening a PR. Does the shape match what you had in mind, in particular the getAll naming and the null-preserving return?
Activity
dlwldnjs1009 commentedon Jul 9, 2026
I'd like to take this one. I ran into it in production with
@RedisHashrepositories, wherefindAllByIdissues oneHGETALLround trip per id, and we currently work around it withexecutePipelined, same as reported in spring-projects/spring-data-redis#3150.Proposed shape, following the issue description:
getAllreturns a list aligned with the given ids, withnullfor ids without a matching entry, so callers can correlate results with ids.KeyValueTemplate.findAllByIduses that to keep publishing per-idbeforeGet/afterGetevents (batched: allbeforeGetevents before the lookup, then oneafterGetper id). Store modules can overridegetAllwith a batched implementation: a pipelinedHGETALLinRedisKeyValueAdapterfor spring-projects/spring-data-redis#3150, which I'd submit as a follow-up PR there.One deliberate choice: a new method name instead of overloading
get. An overloadget(Iterable, String, Class)shifts overload resolution for existing untyped calls:when(mock.get(any(), anyString(), any()))inMapRepositoriesConfigurationExtensionIntegrationTestssilently binds to the new method, and third-party code stubbing or callingKeyValueAdapterthe same way would break identically.SimpleKeyValueRepository.findAllByIdthen delegates toKeyValueOperations.findAllByIdinstead of loopingfindById.I have this implemented locally with unit and integration tests, but wanted to check the API shape here before opening a PR. Does the shape match what you had in mind, in particular the
getAllnaming and the null-preserving return?dlwldnjs1009 commentedon Jul 21, 2026
@mp911de Following up on my comment above: I have an implementation with unit and integration tests ready.
Could you confirm whether
KeyValueAdapter#getAllis the intended name and whether its position-aligned, null-preserving result contract is acceptable?I can open a PR once those API details are settled.
Tighten findAllById tests for repository delegation and result order.
Tighten findAllById template tests for extra lookups and custom keysp…
Make findAllById test failures name the violated expectation.