I have just started to look at Redis and would like to be able to store an Array of hashes, where I can pop a random key/value out and then put it back in when I need to.
So in Ruby I would have something like this
users = [{ username: "user1", password: "password"}, { username: "user2", password: 'password'}]
So if I wanted to get a random key/value object from the Array I would do something like this
@user = users.shuffle!.pop
And then to put it back into the array
users.push(@user)
The idea for using Redis is that I have two processes (Ruby based app) that need to share a pool of users at the same time. Once a process has finished with a user I want it to put it back into the pool.
Could anyone point me in the right direction please
Thanks