title: How to intersect and find different keys in Redis
body: <p>I'm looking to get a list of redis keys as efficient as possible. We can model this on the redis server however we like so this is as much about the proper way to do it as it is solving the problem. Let me describe the situation.</p>
  
  <p>Assume a large set of "Customers" that are stored in Redis as Strings.</p>
  
  <pre><code>customer__100000
  customer__100001
  customer__100002
  </code></pre>
  
  <p>Each customer has quite a few attributes. Of those would be the city that they live in. Each city is also stored in Redis.</p>
  
  <pre><code>city__New York
  city__San Francisco
  city__Washington DC
  </code></pre>
  
  <p>Through a different proces I will end up with a set of customer keys (intersecting sets for a pre-filter.) Once I have those keys I need to find out which <strong>distinct</strong> cities I have within those customers. My end goal here is to get the names of the cities, however if I can get keys which I can pull the city names that's fine as well.</p>
  
  <p>To give an idea for the scale I'm talking about here assume we're dealing with 200-300k customers with around 70 attributes (city being one of them) and each attribute anywhere from 50 - 100,000. I'd like to keep it as efficient as possible.</p>