title: How can I get all matched keys from redis using ruby on rails
body: <p>How Can I get all matched keys from list of keys stored in redis using Ruby on rails. I am using Ruby 2.5.1 version.</p>
  
  <p>I used <strong>SCAN</strong> to query matched keys, but it returns 2 values always instead of 5. It returns all when I pass count. So How can I pass count in Ruby On Rails code?</p>
  
  <p><strong>Without count return 2 value:</strong></p>
  
  <pre><code>  127.0.0.1:6379&gt; SCAN 100 match *sa*
         1) "sasikala (6965)"
         2) "Zupaen sasi (6961)"
  </code></pre>
  
  <p><strong>With count return all (5) value:</strong></p>
  
  <pre><code>127.0.0.1:6379&gt; SCAN 100 match *sa* count 100
             1) "Sasai (6965)"
             2) "Zupaen sasi (6961)"
             3) "Rosan (7000)"
             4) "Alisa (2363)"
             5) "Carissa (4455)"
  </code></pre>
  
  <p><strong>Ruby on rails code:</strong></p>
  
  <pre><code>keys = redis.scan(0, :match =&gt; '*' + name + '*')
  </code></pre>
  
  <p>Kindly provide your thoughts on this.</p>