mirror of
https://github.com/fluencelabs/redis
synced 2025-06-15 10:11:21 +00:00
Added <count> parameter to SPOP:
spopCommand() now runs spopWithCountCommand() in case the <count> param is found. Added intsetRandomMembers() to Intset: Copies N random members from the set into inputted 'values' array. Uses either the Knuth or Floyd sample algos depending on ratio count/size. Added setTypeRandomElements() to SET type: Returns a number of random elements from a non empty set. This is a version of setTypeRandomElement() that is modified in order to return multiple entries, using dictGetRandomKeys() and intsetRandomMembers(). Added tests for SPOP with <count>: unit/type/set, unit/scripting, integration/aof -- Cleaned up code a bit to match with required Redis coding style
This commit is contained in:
committed by
Alon Diamant
parent
c147cd8487
commit
288028876f
@ -651,8 +651,8 @@ struct commandHelp {
|
||||
0,
|
||||
"1.0.0" },
|
||||
{ "SPOP",
|
||||
"key",
|
||||
"Remove and return a random member from a set",
|
||||
"key [count]",
|
||||
"Remove and return one or multiple random members from a set",
|
||||
3,
|
||||
"1.0.0" },
|
||||
{ "SRANDMEMBER",
|
||||
|
Reference in New Issue
Block a user