title: What is the difference between the key and hash key parameters used in a Redis put() statement?
body: <p>I have a Java Spring Boot app that uses Redis for storage.  I have done a fair amount of web searching but I can't find an easy to digest text that explains in detail the ramifications of what values to use/choose for the <em>key</em> parameter vs. the <em>hash key</em> parameter in a Redis <em>put(key, hash key, object)</em> statement.  I am using the Redis store to store a short-lived session management objects that are particular to a specific user ID, and that user ID is guaranteed to be unique.  The object value is a JSON encoded string for a particular class object:</p>
  
  <pre><code>// String format template for storing objects of this class.
  public static final String STORE_MULTI_SELECT_CHOICES = "%s:store:multi_select_choices"
  
  // Store it in Redis for access during the next interaction with the user.
  // The key is the hash key prefix for the MultiSelectChoices class, followed
  //   by the user ID.
  String key = String.format(MultiSelectChoices.STORE_MULTI_SELECT_CHOICES, userId)
  
  // The hash key is just the user ID for now.
  String hashKey = userId
  
  // Serialize the multi-select session management object to a JSON string.
  Gson gson = new Gson();
  String jsonRedisValue = gson.toJson(multiSelect);
  redisTemplate.opsForHash().put(key, hashKey, jsonRedisValue)
  </code></pre>
  
  <p>What is the difference between these two parameters and do you know of a document that explains the performance and value collision ramifications of different choices?  Also, given the nature of my storage operation, do I need to worry about Redis shards or other expert level details or can I reasonably ignore them for now?  The app once put in production, will face a high traffic load.</p>