title: Redis modeling for sorting strings by count
body: <p>I have been storing and incrementing download counters like this:</p>
  
  <pre><code>INCRBY downloads:&lt;filename&gt; 1
  </code></pre>
  
  <p>But now I want to get downloads:* sorted by value so I can display a top downloads list.</p>
  
  <p>I get the feeling I can probably store this better. I fooled around with:</p>
  
  <pre><code>ZINCRBY downloads 1 &lt;filename&gt;
  ZREVRANGEBYSCORE downloads +inf -inf
  </code></pre>
  
  <p>Which does seem to give me the sorted list I want (most downloads to least) but it only returns the <code>&lt;filename&gt;</code>. It appears I would have to query the counts separately.</p>
  
  <p>Basically, in SQL terms, if i may:</p>
  
  <pre><code>select filename, count(*) from downloads
  </code></pre>
  
  <p>How can I structure my Redis data to make that query possible/easy?</p>