-
-
Save stockholmux/712f02c599cfcc5c6cebafeb37cc87e4 to your computer and use it in GitHub Desktop.
This file contains 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
const redis = require('redis'); | |
const client = redis.createClient(/* your configuration info */); | |
const multi = client.multi(); | |
// Create three articles with randomized hits representing user views | |
let id = 100000; | |
while(id--) { | |
multi.SETBIT('article1:today', id, Math.round(Math.random(1))); | |
multi.SETBIT('article2:today', id, Math.round(Math.random(1))); | |
multi.SETBIT('article3:today', id, Math.round(Math.random(1))); | |
} | |
multi.exec(err => { | |
// done | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment