I have users stored in Redis and want to be able to call only certain subsets from a set, if i don't get the correct user back i want to put it back in the set and then try again until i get one of the desired users
@redis = Redis.new @randUser = @redis.spop("users") if @randUser.include?(["user_4", "user_5", "user_6"]) @redis.sadd("users", @randUser) # Run @randUser = @redis.spop("users") again else $user_username = @redis.hget(@randUser, "username") $user_password = @redis.hget(@randUser, "password") end
I cant quite get the logic right in my head, how else could i approach this please?
Any help appreciated