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

Add 'count' option to the 'RANDOMKEY' command #1847

Closed
wants to merge 5 commits into from

Conversation

hwware
Copy link
Member

@hwware hwware commented Mar 13, 2025

Reference the issue redis/redis#11915 and #788
I would like to add one more option for RANDOMKEY command, allow user to get multiply random keys once.
It is similar to existing command ZRANDMEMBER key [count [WITHSCORES]] and SRANDMEMBER key [count]

The new command format as: RANDOMKEY [COUNT count]

If the provided count argument is positive, return an array of distinct elements.
If called with a negative count, the behavior changes and the command is allowed to return the same elements multiple times.

@hwware hwware force-pushed the random-key-count-feature branch from 7f4db05 to e1dacbd Compare March 13, 2025 17:29
Copy link

codecov bot commented Mar 13, 2025

Codecov Report

Attention: Patch coverage is 68.18182% with 14 lines in your changes missing coverage. Please review.

Project coverage is 71.00%. Comparing base (2c9db1a) to head (e1dacbd).
Report is 14 commits behind head on unstable.

Files with missing lines Patch % Lines
src/db.c 68.18% 14 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #1847      +/-   ##
============================================
- Coverage     71.03%   71.00%   -0.03%     
============================================
  Files           123      123              
  Lines         65665    65710      +45     
============================================
+ Hits          46645    46660      +15     
- Misses        19020    19050      +30     
Files with missing lines Coverage Δ
src/commands.def 100.00% <ø> (ø)
src/db.c 88.78% <68.18%> (-0.71%) ⬇️

... and 13 files with indirect coverage changes

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@madolson
Copy link
Member

I'm still not inclined to accept this feature. I don't think it is really that useful.

@hwware
Copy link
Member Author

hwware commented Mar 13, 2025

I'm still not inclined to accept this feature. I don't think it is really that useful.

It is a very old requirement from Redis community, if recently there is no more people to care about it, I will close it later

@hwware
Copy link
Member Author

hwware commented Mar 20, 2025

There is no requirement recently, I decide to close this PR.

@hwware hwware closed this Mar 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants