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

Return empty array for SRANDMEMBER on nonexistent key #376

Merged
merged 2 commits into from
May 27, 2024
Merged

Return empty array for SRANDMEMBER on nonexistent key #376

merged 2 commits into from
May 27, 2024

Conversation

WKBae
Copy link
Contributor

@WKBae WKBae commented May 27, 2024

https://redis.io/docs/latest/commands/srandmember/
SRANDMEMBER with count returns an empty array if the key does not exist.
Updated the implementation and added test for this case.

If the count argument is given, Redis returns an empty array if the key
does not exist, unlike single call which returns nil. Mimic this
behavior more precisely.
@alicebob
Copy link
Owner

thanks! I'll also add a test in ./integration/. Or you can do that, doesn't matter :)

@WKBae
Copy link
Contributor Author

WKBae commented May 27, 2024

Didn't seem hard, I've added a commit.
The former integration test that probably meant SRANDMEMBER nosuch seems to ran SPOP. It is also corrected in the commit.

@alicebob alicebob merged commit 80eb7b3 into alicebob:master May 27, 2024
4 checks passed
@alicebob
Copy link
Owner

Thanks! Merged, will make it a new release in a few days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants