title: data structure best suited for key value pair evaluation
body: <p>I have the pre defined matching as:
  Parent ENTITY has SETs of key values associated with it.
  Each SET under parent ENTIRY may be defined something like</p>
  
  <pre><code>ENTITY A:
      SET A1. {key1=v11 and key2!=v25}
      SET A2. {key1=v12 and key3=v31, v33}
      SET A3. {key1=v15 and key2=v25 and key3=v35}
  
  Entity B:
      SET B1. {key1=v16 and key2=v26}
      SEY B2. {key3!=v39}
      SET B3. {key1!=v11 and key3=v31}
  </code></pre>
  
  <p>I will receive Input as : </p>
  
  <pre><code>{
      key1 : [v11,v12,v13],
      key2 : [v23,v24],
      key3 : [v31,v39]
  }
  </code></pre>
  
  <p>Which means key1 has 3 values, key2 has 2 values and key3 has only one value.</p>
  
  <p>Then I have to return all the entities which have at least one SET whose all key-value matchings are satisfied by the passed key value pairs. </p>
  
  <p>So for the above mentioned entity A, set A1 and set A2 have their key-value pairs satisfied by input whereas for ENTITY B no set has its key-value pairs satisfied.
  So only ENTITY A is the answer.</p>
  
  <p>There can be 200-1000 parent ENTITIES, 20 SETs per parent ENTITY &amp; 200 key-value pairs per SET. Input may contain upto 50 key-value pairs.</p>
  
  <p>I can not query external DB for evaluation. But the Data structure should be serializable to be stored into memcache or redis.</p>