Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
redis backed analytics for node (in progress).
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
examples
lib
test
.gitignore
Makefile
README.md
index.js
package.json

README.md

bitcrunch

Redis analytics for node.js.

Note: not ready for production use.

Bitmaps

Hashes and maps input values to an internal linear identifier via redis-identity. You can then ask the bitmap various questions ranging some simple membership to more complex bitwise operations.

Inspired by: fast-easy-realtime-metrics-using-redis-bitmaps

Basic logic

var bitcrunch = require('bitcrunch');

var won = bitcrunch('won');
var lost = bitcrunch('lost');

// winners

won
.add('a+foobar@email.com')
.add('b+foobar@email.com')
.add('c+foobar@email.com');

// losers

lost
.add('c+foobar@email.com')
.add('d+foobar@email.com');


// won AND lost

won
.and(lost)
.count(function(err, total){
  console.log('%s won and lost', total);
});

// won OR lost

won
.or(lost)
.count(function(err, total){
  console.log('%s won or lost', total);
});

Membership

var bitcrunch = require('bitcrunch');

var likes = bitcrunch('likes')
.add('js')
.add('lua')
.add('redis');

likes.includes('js', function(err, result){
  console.log('result = %s', result);
});

todo

  • command-queue / promises for chaining (that works).
  • complex logic (and/or/and), kinda requires the promises.
  • do we really need to hash values?.
  • NOT.
  • XOR.

attribution

License

MIT

Something went wrong with that request. Please try again.