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
Redis repositories are based on KeyValueRepository, this interface defines Iterable<T> findAllById(Iterable<ID> ids), and the implementation defines a loop executing a findById per id (SimpleKeyValueRepository), but Redis could instead use the operation MGET to execute in a single request to the Redis server all requested ids.
Have you analyzed this alternative? Or maybe adding an extra method like Iterable<T> multiFindById(Iterable<ID> ids) taking advantage of the operation MGET?
Thanks for your time.
The text was updated successfully, but these errors were encountered:
Hello, I'm interested in this. I am using spring-data-redis repositories and findAllById is very slow. As I cannot use MGET for that, I switched to something like:
redisTemplate.executePipelined { connection: RedisConnection ->
val serializer = redisTemplate.stringSerializer
for (key in keys) {
serializer.serialize(key)?.let { connection.hashCommands().hGetAll(it) }
}
null
}
But it would be nice if it was backed in the provided repositories.
Redis repositories are based on
KeyValueRepository
, this interface definesIterable<T> findAllById(Iterable<ID> ids)
, and the implementation defines a loop executing afindById
per id (SimpleKeyValueRepository
), but Redis could instead use the operation MGET to execute in a single request to the Redis server all requested ids.Have you analyzed this alternative? Or maybe adding an extra method like
Iterable<T> multiFindById(Iterable<ID> ids)
taking advantage of the operation MGET?Thanks for your time.
The text was updated successfully, but these errors were encountered: