Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReactiveKeyCommands.Exists to check multiple key existence #2883

Open
kutlueren opened this issue Mar 28, 2024 · 7 comments · May be fixed by #2918
Open

ReactiveKeyCommands.Exists to check multiple key existence #2883

kutlueren opened this issue Mar 28, 2024 · 7 comments · May be fixed by #2918
Labels
status: ideal-for-contribution An issue that a contributor can help us with type: enhancement A general enhancement

Comments

@kutlueren
Copy link

kutlueren commented Mar 28, 2024

I am using the function to check if a key exist or not, but actually I have a list of keys that needs to be checked. I can't find a func that would accept a list of keys and do this as a bulk check. Is there a reason why this was not implemented? if not, would that be possible to implement it? it is already implemented in jedis.

I have achieved this by the following implementation:

 redisOperations.execute { connection ->
                val keyCommands = connection.keyCommands()
                val existsMonos = keys.map { key ->
                    keyCommands.exists(ByteBuffer.wrap(key))
                        .map { it == true }
                        .onErrorReturn(false)
                }
                Mono.zip(existsMonos) { it }
            }.awaitFirst()

redisOperations is a ReactiveRedisOperations type.

The versions:

org.springframework.data:spring-data-redis:3.2.2
java 21.0.2-librca
Kotlin compiler version 1.9.22

Thank you

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Mar 28, 2024
@kutlueren kutlueren changed the title EXISTS to check multiple key existence ReactiveKeyCommands.Exists to check multiple key existence Mar 28, 2024
@mp911de mp911de added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Apr 4, 2024
@mp911de
Copy link
Member

mp911de commented Apr 4, 2024

Currently, exists supports only single-key arguments. It makes sense to introduce method overloads returning a result for multiple keys.

@AnneMayor
Copy link
Contributor

May I handle this issue? I will figure it out and open PR if possible.

@mp911de
Copy link
Member

mp911de commented May 13, 2024

Sure, feel free to have a look @AnneMayor

@mp911de mp911de added the status: ideal-for-contribution An issue that a contributor can help us with label May 13, 2024
@AnneMayor
Copy link
Contributor

Thank, @mp911de I will go on after #2905 PR merged :)

@kutlueren
Copy link
Author

Awesome to see that it is being tackled 👏🏻

@AnneMayor
Copy link
Contributor

@kutlueren
Hi🙂Thanks for asking. I am handling this issue for now. I am going to open PR within this weekend. If there's no PR after that you can take this one instead🙂

@kutlueren
Copy link
Author

kutlueren commented May 21, 2024

@AnneMayor thanks a lot! I initially wanted to tackle it but it was beyond my comprehension. I am happy to review your PR though 🙂

@AnneMayor AnneMayor linked a pull request May 26, 2024 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: ideal-for-contribution An issue that a contributor can help us with type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants