You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
Export RedisClient prototype to support extending.
See examples/extend.js for a simple example. Remove command list from exports while I was in there.
This commit is contained in:
10
index.js
10
index.js
@@ -4,7 +4,8 @@ var net = require("net"),
|
||||
sys = require("sys"),
|
||||
events = require("events"),
|
||||
default_port = 6379,
|
||||
default_host = "127.0.0.1";
|
||||
default_host = "127.0.0.1",
|
||||
commands;
|
||||
|
||||
exports.debug_mode = false;
|
||||
|
||||
@@ -425,6 +426,7 @@ function RedisClient(stream) {
|
||||
events.EventEmitter.call(this);
|
||||
}
|
||||
sys.inherits(RedisClient, events.EventEmitter);
|
||||
exports.RedisClient = RedisClient;
|
||||
|
||||
RedisClient.prototype.connection_gone = function (why) {
|
||||
var self = this;
|
||||
@@ -663,7 +665,7 @@ RedisClient.prototype.end = function () {
|
||||
};
|
||||
|
||||
// http://code.google.com/p/redis/wiki/CommandReference
|
||||
exports.commands = [
|
||||
commands = [
|
||||
// Connection handling
|
||||
"QUIT", "AUTH",
|
||||
// Commands operating on all value types
|
||||
@@ -693,7 +695,7 @@ exports.commands = [
|
||||
"PING",
|
||||
];
|
||||
|
||||
exports.commands.forEach(function (command) {
|
||||
commands.forEach(function (command) {
|
||||
RedisClient.prototype[command] = function () {
|
||||
var args = to_array(arguments);
|
||||
args.unshift(command); // put command at the beginning
|
||||
@@ -710,7 +712,7 @@ function Multi(client, args) {
|
||||
}
|
||||
}
|
||||
|
||||
exports.commands.forEach(function (command) {
|
||||
commands.forEach(function (command) {
|
||||
Multi.prototype[command.toLowerCase()] = function () {
|
||||
var args = to_array(arguments);
|
||||
args.unshift(command);
|
||||
|
Reference in New Issue
Block a user