title: Transactions in Redis with read operations
body: <p>Using Redis, I want to perform an atomic sequence of commands, i.e. I need to guarantee that no other client will perform changes in the database while the sequence is being executed.</p>
  
  <p>If I used <strong>write</strong> commands only, I could use <code>MULTI</code> and <code>EXEC</code> statements to assure atomicity using transactions. However, I would also like to use <strong>read</strong> commands in my transactions. Hence I cannot use <code>MULTI</code>, because read commands are also being queued!</p>
  
  <p>Basically, in atomic manner, I need to do following:</p>
  
  <ol>
  <li>Read <code>x</code> from the database,</li>
  <li>Based on <code>x</code>, store <code>f(x)</code> to the database.</li>
  </ol>
  
  <p>Both 1. and 2. should be part of a single, atomic transaction.</p>
  
  <p>Is there a simple way how to do that?</p>