Skip to content

Instantly share code, notes, and snippets.

@nitesh123
Created June 28, 2012 18:53
Show Gist options
  • Save nitesh123/3013190 to your computer and use it in GitHub Desktop.
Save nitesh123/3013190 to your computer and use it in GitHub Desktop.
RedisClient.prototype.write = function (args,callback) {
var self = this;
this.send_command('write', to_array(arguments), function (err, res) {
if (err === null) {
}
if (typeof(callback) === 'function') {
callback(err, res);
}
});
};
RedisClient.prototype.WRITE = RedisClient.prototype.write;
-----------
command_obj = new Command(command, args, false, buffer_args, callback);
if ((!this.ready && !this.send_anyway) || !stream.writable) {
if (exports.debug_mode) {
if (!stream.writable) {
console.log("send command: stream is not writeable.");
}
console.log("Queueing " + command + " for next server connection.");
}
this.offline_queue.push(command_obj);
this.should_buffer = true;
return false;
}
//stream ops go here
if ( command === "flush") {
stream.write("*0\r\n\r\n");
this.command_queue.push(command_obj);
this.commands_sent += 1;
return true;
} else if (command === "read" ) {
} else if (command === "write" ) {
var str = String(args[0]);
stream.write(str);
this.command_queue.push(command_obj);
this.commands_sent += 1;
return true;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment