Created
December 15, 2012 20:06
-
-
Save gjohnson/4298762 to your computer and use it in GitHub Desktop.
ideas for the api
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://amix.dk/blog/post/19714#bitmapist-Powerful-realtime-analytics-with-Redis-2-6s-bitmaps-and | |
var bitcrunch = require('bitcrunch') | |
, client = bitcrunch.connect(); | |
// mark user 123 as active and has played a song: | |
client.mark('active', 123, fn); | |
client.mark('song:played', 123, fn); | |
// timebased queries | |
var active = client.monthly('active', new Date); | |
var played = client.monthly('song:played', new Date); | |
// count the active users/players | |
active.count(fn); | |
played.count(fn); | |
// bit operations w/ composition | |
active | |
.and(played) | |
.count(fn); | |
active | |
.or(played) | |
.count(fn); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Finally got around to this if your interested in tinkering... do you happen to know of a decent, minimal command-queue / promise-like module for handling sequential chaining?
https://github.com/gjohnson/bitcrunch