Created
August 31, 2011 10:32
-
-
Save booo/1183264 to your computer and use it in GitHub Desktop.
redis error handling
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
| pg = require "pg" | |
| http = require "http" | |
| redis = require "redis" | |
| rclient = redis.createClient() | |
| rclient.on "error", (error) -> | |
| console.log error | |
| (http.createServer (req, res) -> | |
| setTimeout -> | |
| console.log "Trying to get value for key" | |
| rclient.get "akey", (error, result) -> | |
| "redis command executed..." | |
| if error | |
| res.writeHead 500 | |
| res.end error | |
| else | |
| res.writeHead 200 | |
| res.end result | |
| , 1000*15 | |
| ).listen 1337 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment