title: Proper way to update specific record on the LIST/SET in Redis
body: <p>I'm planning to use Redis as my 2nd class database for my PHP API (Predis for PHP &amp; Redis connection), my main database is MySQL. I am new to it and I'm wondering if I'm on right path or I'm completely doing it wrong.</p>
  
  <p>I will use Redis for all "SELECT" or Retrieval queries instead of getting it from MySQL. Here's the sample flow.</p>
  
  <p>I have a user who has multiple record on other table (1:many). TableA contains all the users and TableB contains all experience records of all users.</p>
  
  <pre><code>**TableA**
  UserID - 1234
  UserID - 4567
  UserID - 7890
  
  -------------------------------------------------------
  
  
  **TableB**
  ExperienceID - 1    |   UserID - 1234   |   Experience - Waiter
  ExperienceID - 2    |   UserID - 1234   |   Experience - Chef
  ExperienceID - 3    |   UserID - 4567   |   Experience - Developer
  ExperienceID - 4    |   UserID - 4567   |   Experience - Technician
  ExperienceID - 5    |   UserID - 4567   |   Experience - Support
  ExperienceID - 6    |   UserID - 7890   |   Experience - Engineer
  ExperienceID - 7    |   UserID - 7890   |   Experience - Engineer
  ExperienceID - 8    |   UserID - 7890   |   Experience - Draftsman
  </code></pre>
  
  <ul>
  <li>Save new experience on MySQL and once success it will push the same experience on Redis (on redis format).</li>
  <li>Get/Retreive all records from Redis instead of MySQL</li>
  <li>Update the experience on MySQL and once success it will update the specific experience on Redis ---> <em>I don't know how to do this on Redis without looping it on PHP which is not good idea if I have huge list of records</em> :(</li>
  </ul>
  
  <p>Here is my layout in Redis.</p>
  
  <pre><code>uid:1234:experience
  uid:4567:experience
  uid:7890:experience
  </code></pre>
  
  <p>Inside of the record experience namespace</p>
  
  <p>I used SADD with json encoded data to set</p>
  
  <pre><code>$userExperience1 = array(
      'id'            =&gt; 1,
      'user_id'       =&gt; 1234,
      'experience'    =&gt; 'Waiter'
  );
  
  $userExperience2 = array(
      'id'            =&gt; 2,
      'user_id'       =&gt; 1234,
      'experience'    =&gt; 'Chef'
  );
  
  
  $redis-&gt;sadd('uid:' . $userId . ':experience', json_encode($userExperience1));
  $redis-&gt;sadd('uid:' . $userId . ':experience', json_encode($userExperience2));
  </code></pre>
  
  <p>I also tried using LIST</p>
  
  <pre><code>$redis-&gt;rpush('uid:' . $userId . ':experience', json_encode($userExperience1));
  $redis-&gt;rpush('uid:' . $userId . ':experience', json_encode($userExperience2));
  </code></pre>
  
  <p>But I don't know the proper way to update specific record on redis, like I want to update only the "Waiter" experience of user 1234.</p>
  
  <p>Any suggesstions or advice? Thanks guys.</p>