title: Redis-python add multiple values of type set to a redis hash
body: <p>Redis n00b here so don't shoot!</p>
  <p>I need to store a collection of sets in redis indexed by key - I can:</p>
  <pre><code>import redis
  r = redis.Redis()
  
  r.sadd(&quot;A:B:123&quot;, *{456, 789})
  r.sadd(&quot;A:B:124&quot;, *{666, 777})
  </code></pre>
  <p>but then if I want the collection &quot;A:B&quot; I have to collect the keys manually as in:</p>
  <pre><code>{k.rsplit(b':', 1)[-1]: r.smembers(k) for k in r.scan_iter(&quot;A:B:*&quot;) }
  # {b'124': {b'666', b'777'}, b'123': {b'456', b'789'}}
  </code></pre>
  <p>This seems awfully slow (note also the rsplit)</p>
  <p>I have been trying to use hmset to do the trick:</p>
  <pre><code>r.hmset(&quot;A:B&quot;, mapping={123: 'X', 124: 'Z'})
  </code></pre>
  <p>but I can't find a way of substituting my sets for 'X' and 'Z'.</p>
  <p>(note that ideally set elements should be of type int as passed in - note also that those collections are meant to be read only, so I want to optimize lookup not insertion time)</p>