When I use rpop on a list that I previously had pushed an array containing 4 values to, Redis returns all 4 values as expected. My problem is that they are returned as single values. Is there a way to have Redis return an array containing the 4 values as opposed to returning the 4 values the array contains? I am using the node_redis client https://github.com/NodeRedis/node_redis. Here is some code to give you an idea of what I am doing.
redisClient.lpush(data.pushKey, data.rowTest);
data.rowtest looks like this [ 0, 496, 1, 48 ].
redisClient.rpop(data.popKey, function (err, res) {
if (err) { console.log(err); }
if (res !== null) {
client.send("fromList", { content: res });
console.log(res);
}
});
I am expecting an output of [ 0, 496, 1, 48 ] on a single line, but I am getting 0 496 1 48 each on a separate line.
Ok, I'm pretty sure I need to learn how to work with asynchronous javascript, before I solve my issue above.