Pages

Friday, May 4, 2012

A Node.JS web server storing data in REDIS

Node_redis (https://github.com/mranney/node_redis) is a great module that allows you to retrieve and publish data to REDIS cache from node.js apps.  The interface is really clean and simple.

Getting/Setting Data


// create a redis client
var redis = require("redis"),
    client = redis.createClient();
// error handler
client.on("error", function (err) {
    console.log("Could not connect to redis: " + err);
});
// set a value
client.set("key1", "value1", redis.print);
// close a connection
client.quit(function (err, res) {
    console.log("Closing connection.");
});

Pub-Sub Queue

var redis = require("redis"),
    client = redis.createClient()

// Subscribe to channel
client.on("subscribe", function (channel, count) {
    console.log("client subscribed to " + channel);
});


client.on("message", function (channel, message) {
    console.log("Received message " + message + " on channel " + channel);
});

client.on("unsubscribe", function (channel, count) {
    console.log("Unsubscribed channel " + channel);
    client.end();
});





Reactions:

9 comments:

Designer handbags can add to the elegance, prettiness or archness of a dress. It is about like an addendum of louis vuitton replica what the dress is aggravating to convey. A bag that does not go with your dress or looks out of abode can be a big appearance disaster. Every woman wants to accept Artist handbags that reflect their appearance and attending enviable if they backpack them. You will acquisition abounding places in Australia that advertise the replica of these artist handbags, about owning the absolute being is a abundant bigger advantage than opting for the bargain ones. You will apprehension that there is a huge aberration in the actual of the gucci replica accoutrements additional it is no fun in owning a affected brand. Buy new artist handbags and backpack them with panache! You will be afraid to see how abounding options are accessible to you. You can accept from a array of clutches, purses, satchel, tote and bung bags. You can backpack them with altered dresses on occasions alignment from academic to informal.Sometimes women go amiss while bond them up with dresses. While affairs a bag accomplish abiding that you accept at atomic one dress in apperception that will go with the bag, if not again buy one! Don't backpack accoutrements with dresses just because you wish to appearance off your new artist handbags you ability end up traveling absolutely wrong. If your dress does not advice in bringing out the adorableness of your bag or carnality a versa again you are not dressed right. The aboriginal affair to breitling replica accumulate in apperception is what blush you wish to buy. We are abiding that you don't wish to absorb all those dollars on a chicken bag that you anticipation would attending alarming with your admired brace of socks! Artist handbagsare like an investment if you are not accurate area you advance you ability in fact end up on the accident side. So if you are clueless about the blush you wish to opt for them accumulate the 'black consistently works' aphorism in mind. Just go for a atramentous bag that is neither too academic nor too blingy. You wish everybody's eyes on you and not in a bad way. So go for a bag that can go able-bodied with a academic as able-bodied as a accidental dress. About if you don't accept a account to stick to, again sky is the absolute for you. You can accept from a array of types of chanel replica purses that will not alone amount you a few hundred dollars but will accomplish you attending like a actor dollars

Check out Euro Cup 2016 to know everything about Euro Cup 2016,which is due to start on 10th June in France and also watch all the matches live.

Have a look at Veterans Day Poems if you want to know about veterans day and why is it celebrated.

Know about world's best games info, visit our site THE GAMERS DEN

Your blog is very helpful to us, thanks for sharing this. You can also enjoy your new year with New Year 2017 Images and Pictures

Post a Comment