Redis SET with option, without expiry
<p>I'm writing a library that stores keys in Redis or Memcached. To keep it generic, I'd like to use <code>SET</code> for all my set operations, but I'm struggling to find an expiry value that equates to "don't expire". Is there a sentinel value I can send?</p>

<p>For example, If there's an expiry of 100, I'd like to send:</p>

<pre><code>SET myKey myValue ex 100 NX
</code></pre>

<p>but if there's no expiry, I'd prefer to do</p>

<pre><code>SET myKey myValue ex -1 NX
</code></pre>

<p>rather than</p>

<pre><code>SETNX myKey myValue
</code></pre>

<p>Interestingly, there doesn't appear to be any way to do the equivalent of a <code>SET</code> using the <code>XX</code> option without an expiry.</p>