title: SCAN command performance with phpredis
body: <p>I'm replacing KEYS with SCAN using phpredis.</p>
  
  <pre><code>$redis = new Redis();
  $redis-&gt;connect('127.0.0.1', 6379);
  $redis-&gt;setOption(Redis::OPT_SCAN, Redis::SCAN_RETRY);
  $it = NULL;
  while($arr_keys = $redis-&gt;scan($it, "mykey:*", 10000)) {
      foreach($arr_keys as $str_key) {
          echo "Here is a key: $str_key\n";
      }
  }
  </code></pre>
  
  <p>According to <a href="http://redis.io/commands/keys" rel="nofollow noreferrer">redis documentation</a>, I use SCAN to paginate searches to avoid disadvantage of using KEYS. <br/>
  But in practice, using above code costs me 3 times lower than using just a single <code>$redis-&gt;keys()</code> <br/>
  So I'm wondering if I've done something wrong, or I have to pay speed to avoid KEYS's threat? <br/></p>
  
  <p>Note that I totally have 400K+ keys in my db, and 4 <code>mykey:*</code> keys</p>