Simple redis get() from node_redis

183 views
Skip to first unread message

wenbert

unread,
Aug 3, 2011, 6:16:21 AM8/3/11
to nowjs
Hello, I'm not sure where to address this question, but I have a very
app running on nodejs, nowjs, with node_redis.

I am trying to get a value from the key: card

//REDIS
var redis = require("redis"),
client = redis.createClient();

client.on("error", function (err) {
console.log("Error "+ err);
});

client.set("card", "apple");

everyone.now.signalShowRedisCard = function() {

nowjs.getGroup(this.now.room).now.receiveShowRedisCard(client.get("card").toString());
}
In my client side:

now.receiveShowRedisCard = function(card_id) {
alert("redis card: "+card_id);
}
The alert only gives out "true" - I was expecting to get the value of
the key "card" which is "apple".

Any ideas?

PS: I have a crosspost for this question is Stackoverflow (decided to
post the question here after finding out there are only about 17 posts
tagged in SO for nowjs :-( )

Vladimir Dronnikov

unread,
Aug 17, 2011, 12:40:29 PM8/17/11
to no...@googlegroups.com
> client.get("card")

client.get() is async, should be client.get("card", function(err,
value) { "use-value-here" })

Reply all
Reply to author
Forward
0 new messages