Is it possible to shuffle a list in Redis (server-side)?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Not with version 2.4.
With the future 2.6 release, perhaps it could be implemented with Lua server-side scripting, but I don’t expect this to be really efficient.
I don’t know about your use case, but if you can live with unicity for your items, you can perhaps replace the list by a set and use the SPOP command. Instead of shuffling your list and removing items in a specific order, you can use an unordered container and pop out random items.