Estimate Top-k elements in data stream using SpaceSaver algorithm. The project use Redis as the backend. Note that this project is being actively developed. If you discover an issue, please fork or submit a ticket describing the problem.
npm install spacesaver-js
var SpaceSaver = ;var k = 100;var spacesaver = k;var leaderboard = 'top-news-sites';var members = 'www.nytimes.com' 'www.cnn.com' 'www.huffpo.com';
// news - top k'www.nytmes.com': '240988''www.yahoo.com': '240849''www.google.com': '240368''www.cnn.com': '170723''': '10000'// social - top 1 of k'www.twitter.com': '170723'
Test is broken since the switch to support internal queues. Prior to this, you needed to add a member one at a time. Now you can pass a collection of memebers to increment!
Just fork and issue a pull request :-)