title: Redis: Transaction with multiple keys
body: <p>I'm using Spring Data Redis. In Redis the basic data models are</p>
  
  <p><code>job</code>: Hash that contains a job's data.</p>
  
  <p><code>queue</code>: List that contains job ids serving as a queue.</p>
  
  <p>New job will be saved in <code>job</code> hash and it will be pushed to <code>queue</code>. We have multiple worker clients pooling the <code>queue</code> to consume new job id by popping the id and read details from hash. </p>
  
  <p>Now I'm trying to work out a new feature that certain worker can only consume certain jobs, based on some flags within job data. The problem is worker will only know if it can consume the job after reading its details, but not at the moment of taking the id from the queue. </p>
  
  <p>I originally thought I can put this sequence of operations into a transaction, </p>
  
  <ol>
  <li>Peek the queue.</li>
  <li>Read job details from hash and check if consumable.</li>
  <li>If yes, take its id from queue, otherwise do nothing.</li>
  </ol>
  
  <p>However this kind of transaction involves both queue and hash data. After reading Redis's transaction support I'm not sure if this is achievable. Please help to advise what approach should I take.</p>