Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bitcrunch

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bitcrunch

streaming cardinatility estimations

  • 0.0.0
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

bitcrunch

Probabilistic counters for node.js, backed by redis.

Note: not ready for production use.

linear counting

Currently the only structure implemented is a linear counter. It hashes and maps input values to an internal linear identifier via redis-identity.

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 (for linear).
  • max-size for linear
  • linear NOT.
  • linear XOR.
  • more counter types (HLL, Bloom, etc).

attribution

  • fast-easy-realtime-metrics-using-redis-bitmaps
  • bitmapist
  • crashlytics-on-redis-analytics
  • probabilistic-structures

License

MIT

Keywords

FAQs

Package last updated on 27 Feb 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc