Main idea is to store random bits to redis and retrieve and drop them when required.
Pseudocode which sets the boolean value to the next position of the bitcollection. This way I should have a growing collection of bits.
Setter:
boolean = rand(1/0)
SETBIT bitcollection boolean (BITCOUNT bitcollection + 1)
Getter:
GETBIT bitcollection 0
Questions: How can I drop the retrieved bit from position 0? Is it possible to retrieve more than just the first bit like (0..n)?
Ruby code for better understanding what I try to achieve.
bitcollection = [0, 1, 0, 1, 0]
# set
bitcollection.push 1 #=> [0, 1, 0, 1, 0, 1]
# get
bitcollection.shift(1) #=> 0
puts bitcollection #=> [1, 0, 1, 0, 1]