title: Username or ID for keys in Redis
body: <p>I was wondering what the benefits of using user IDs were rather than just using the unique username for the keys.</p>
  
  <ul>
  <li>user:USERNAME => {password: HASH, age: 45}</li>
  <li>user:0 => {username: USERNAME, password: HASH, age: 45}</li>
  </ul>
  
  <p>Note that I would wish to lookup users by name, therefore requiring a second set of key-values to relate usernames to IDs.</p>
  
  <p>Given that every username is unique and has to be alphanumeric is there any particular reason why it may be beneficial to use the ID system.</p>
  
  <p>The main reason I ask this is because I primarily used IDs as they decreased lookup times in my database, especially when the database was normalized in some way. But Redis doesn't gain this benefit and so I wondered what other reasons there may be to use user IDs instead of just the usernames.</p>
  
  <p>Thanks for any help,</p>
  
  <p>Pluckerpluck</p>
  
  <p>p.s. Due to the way Redis handles hashes I am very actually unsure about the memory differences between the two methods so information on this may be good, though I may go and test this myself later.</p>