title: How to store simple arrays in Redis
body: <p>I'd like to know what would be the best way to store IPs (not a lot of them (&lt;50)) together with some meta data (time added, note) in Redis. I need to be able to quickly determine if some IP is in that list and be able to retrieve all stored IPs.</p>
  
  <p>I have some ideas but they don't seem elegant/efficient to me:</p>
  
  <ul>
  <li>Store IPs using lists where each entry is array (ip,note,timestamp). This would make retrieving of all the IPs simple, but would require looping trough all the IPs do determine if a given IP is in the list or not. So this is good to retrieve all IPs but not so good for checking for existence of one IP.</li>
  <li>Store IPs using hash tables, where IP is part of the key, and meta data are fields in the hash. This would allow me to check if a IP is stored very simply (exists()), but would require  a separate redis list to keep track of stored IPs (which would require for me to be very careful when adding/removing IPs) and I would have to execute 1 + count(ips) operations to get all stored IPs and their meta information. So this way is good for checking for existence of one IP but is not good for retrieving all IPs.</li>
  </ul>
  
  <p>Is there some other way of doing this with redis or will I have to use one of the above approaches (if so, which one is the best)?</p>