Created
August 13, 2012 17:43
-
-
Save saadullahsaeed/3342710 to your computer and use it in GitHub Desktop.
Testing 'setbit' and 'bitcount' on Redis 2.6
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
express = require 'express' | |
redis = require 'redis' | |
app = express() | |
requestCount = 0 | |
client = null | |
#Going to use Date as the Key | |
getKey= -> | |
d = new Date() | |
"#{d.getFullYear()}-#{d.getMonth()}-#{d.getDate()}" | |
logView= -> | |
key = getKey() | |
console.log "Logging view for #{key}" | |
client.setbit key, requestCount, 1 | |
requestCount++ | |
initRedis= -> | |
client = redis.createClient() | |
client. on "error", (err)=> console.log "Error: #{err}" | |
app.get '/', (req, res)=> | |
res.send '1' | |
logView() | |
initRedis() | |
app.listen 3000 | |
console.log "Listening Now " |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment