redis 3.1.0 → 3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/heroku/index.js +14 -0
- package/heroku/node_modules/.package-lock.json +57 -0
- package/heroku/node_modules/denque/CHANGELOG.md +4 -0
- package/heroku/node_modules/denque/LICENSE +13 -0
- package/heroku/node_modules/denque/README.md +362 -0
- package/heroku/node_modules/denque/index.d.ts +31 -0
- package/heroku/node_modules/denque/index.js +443 -0
- package/heroku/node_modules/denque/package.json +55 -0
- package/heroku/node_modules/redis/.deepsource.toml +9 -0
- package/heroku/node_modules/redis/CHANGELOG.md +880 -0
- package/heroku/node_modules/redis/LICENSE +24 -0
- package/heroku/node_modules/redis/README.md +1009 -0
- package/{a.js → heroku/node_modules/redis/a.js} +0 -0
- package/heroku/node_modules/redis/index.js +1039 -0
- package/heroku/node_modules/redis/lib/command.js +16 -0
- package/heroku/node_modules/redis/lib/commands.js +105 -0
- package/heroku/node_modules/redis/lib/createClient.js +88 -0
- package/heroku/node_modules/redis/lib/customErrors.js +58 -0
- package/heroku/node_modules/redis/lib/debug.js +13 -0
- package/heroku/node_modules/redis/lib/extendedApi.js +113 -0
- package/heroku/node_modules/redis/lib/individualCommands.js +629 -0
- package/heroku/node_modules/redis/lib/multi.js +187 -0
- package/heroku/node_modules/redis/lib/utils.js +134 -0
- package/{npm → heroku/node_modules/redis/npm} +0 -0
- package/heroku/node_modules/redis/package.json +77 -0
- package/heroku/node_modules/redis-commands/LICENSE +22 -0
- package/heroku/node_modules/redis-commands/README.md +51 -0
- package/heroku/node_modules/redis-commands/changelog.md +83 -0
- package/heroku/node_modules/redis-commands/commands.json +2334 -0
- package/heroku/node_modules/redis-commands/index.js +168 -0
- package/heroku/node_modules/redis-commands/package.json +41 -0
- package/heroku/node_modules/redis-commands/tools/build.js +62 -0
- package/heroku/node_modules/redis-errors/LICENSE +22 -0
- package/heroku/node_modules/redis-errors/README.md +116 -0
- package/heroku/node_modules/redis-errors/index.js +7 -0
- package/heroku/node_modules/redis-errors/lib/modern.js +59 -0
- package/heroku/node_modules/redis-errors/lib/old.js +119 -0
- package/heroku/node_modules/redis-errors/package.json +41 -0
- package/heroku/node_modules/redis-parser/LICENSE +22 -0
- package/heroku/node_modules/redis-parser/README.md +166 -0
- package/heroku/node_modules/redis-parser/changelog.md +156 -0
- package/heroku/node_modules/redis-parser/index.js +3 -0
- package/heroku/node_modules/redis-parser/lib/parser.js +552 -0
- package/heroku/node_modules/redis-parser/package.json +53 -0
- package/heroku/package.json +9 -0
- package/lib/utils.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var Queue = require('denque');
|
|
4
|
+
var utils = require('./utils');
|
|
5
|
+
var Command = require('./command');
|
|
6
|
+
|
|
7
|
+
function Multi (client, args) {
|
|
8
|
+
this._client = client;
|
|
9
|
+
this.queue = new Queue();
|
|
10
|
+
var command, tmp_args;
|
|
11
|
+
if (args) { // Either undefined or an array. Fail hard if it's not an array
|
|
12
|
+
for (var i = 0; i < args.length; i++) {
|
|
13
|
+
command = args[i][0];
|
|
14
|
+
tmp_args = args[i].slice(1);
|
|
15
|
+
if (Array.isArray(command)) {
|
|
16
|
+
this[command[0]].apply(this, command.slice(1).concat(tmp_args));
|
|
17
|
+
} else {
|
|
18
|
+
this[command].apply(this, tmp_args);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function pipeline_transaction_command (self, command_obj, index) {
|
|
25
|
+
// Queueing is done first, then the commands are executed
|
|
26
|
+
var tmp = command_obj.callback;
|
|
27
|
+
command_obj.callback = function (err, reply) {
|
|
28
|
+
// Ignore the multi command. This is applied by node_redis and the user does not benefit by it
|
|
29
|
+
if (err && index !== -1) {
|
|
30
|
+
if (tmp) {
|
|
31
|
+
tmp(err);
|
|
32
|
+
}
|
|
33
|
+
err.position = index;
|
|
34
|
+
self.errors.push(err);
|
|
35
|
+
}
|
|
36
|
+
// Keep track of who wants buffer responses:
|
|
37
|
+
// By the time the callback is called the command_obj got the buffer_args attribute attached
|
|
38
|
+
self.wants_buffers[index] = command_obj.buffer_args;
|
|
39
|
+
command_obj.callback = tmp;
|
|
40
|
+
};
|
|
41
|
+
self._client.internal_send_command(command_obj);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
Multi.prototype.exec_atomic = Multi.prototype.EXEC_ATOMIC = Multi.prototype.execAtomic = function exec_atomic (callback) {
|
|
45
|
+
if (this.queue.length < 2) {
|
|
46
|
+
return this.exec_batch(callback);
|
|
47
|
+
}
|
|
48
|
+
return this.exec(callback);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
function multi_callback (self, err, replies) {
|
|
52
|
+
var i = 0, command_obj;
|
|
53
|
+
|
|
54
|
+
if (err) {
|
|
55
|
+
err.errors = self.errors;
|
|
56
|
+
if (self.callback) {
|
|
57
|
+
self.callback(err);
|
|
58
|
+
// Exclude connection errors so that those errors won't be emitted twice
|
|
59
|
+
} else if (err.code !== 'CONNECTION_BROKEN') {
|
|
60
|
+
self._client.emit('error', err);
|
|
61
|
+
}
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (replies) {
|
|
66
|
+
while (command_obj = self.queue.shift()) {
|
|
67
|
+
if (replies[i] instanceof Error) {
|
|
68
|
+
var match = replies[i].message.match(utils.err_code);
|
|
69
|
+
// LUA script could return user errors that don't behave like all other errors!
|
|
70
|
+
if (match) {
|
|
71
|
+
replies[i].code = match[1];
|
|
72
|
+
}
|
|
73
|
+
replies[i].command = command_obj.command.toUpperCase();
|
|
74
|
+
if (typeof command_obj.callback === 'function') {
|
|
75
|
+
command_obj.callback(replies[i]);
|
|
76
|
+
}
|
|
77
|
+
} else {
|
|
78
|
+
// If we asked for strings, even in detect_buffers mode, then return strings:
|
|
79
|
+
replies[i] = self._client.handle_reply(replies[i], command_obj.command, self.wants_buffers[i]);
|
|
80
|
+
if (typeof command_obj.callback === 'function') {
|
|
81
|
+
command_obj.callback(null, replies[i]);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
i++;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (self.callback) {
|
|
89
|
+
self.callback(null, replies);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
Multi.prototype.exec_transaction = function exec_transaction (callback) {
|
|
94
|
+
if (this.monitoring || this._client.monitoring) {
|
|
95
|
+
var err = new RangeError(
|
|
96
|
+
'Using transaction with a client that is in monitor mode does not work due to faulty return values of Redis.'
|
|
97
|
+
);
|
|
98
|
+
err.command = 'EXEC';
|
|
99
|
+
err.code = 'EXECABORT';
|
|
100
|
+
return utils.reply_in_order(this._client, callback, err);
|
|
101
|
+
}
|
|
102
|
+
var self = this;
|
|
103
|
+
var len = self.queue.length;
|
|
104
|
+
self.errors = [];
|
|
105
|
+
self.callback = callback;
|
|
106
|
+
self._client.cork();
|
|
107
|
+
self.wants_buffers = new Array(len);
|
|
108
|
+
pipeline_transaction_command(self, new Command('multi', []), -1);
|
|
109
|
+
// Drain queue, callback will catch 'QUEUED' or error
|
|
110
|
+
for (var index = 0; index < len; index++) {
|
|
111
|
+
// The commands may not be shifted off, since they are needed in the result handler
|
|
112
|
+
pipeline_transaction_command(self, self.queue.get(index), index);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
self._client.internal_send_command(new Command('exec', [], function (err, replies) {
|
|
116
|
+
multi_callback(self, err, replies);
|
|
117
|
+
}));
|
|
118
|
+
self._client.uncork();
|
|
119
|
+
return !self._client.should_buffer;
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
function batch_callback (self, cb, i) {
|
|
123
|
+
return function batch_callback (err, res) {
|
|
124
|
+
if (err) {
|
|
125
|
+
self.results[i] = err;
|
|
126
|
+
// Add the position to the error
|
|
127
|
+
self.results[i].position = i;
|
|
128
|
+
} else {
|
|
129
|
+
self.results[i] = res;
|
|
130
|
+
}
|
|
131
|
+
cb(err, res);
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
Multi.prototype.exec = Multi.prototype.EXEC = Multi.prototype.exec_batch = function exec_batch (callback) {
|
|
136
|
+
var self = this;
|
|
137
|
+
var len = self.queue.length;
|
|
138
|
+
var index = 0;
|
|
139
|
+
var command_obj;
|
|
140
|
+
if (len === 0) {
|
|
141
|
+
utils.reply_in_order(self._client, callback, null, []);
|
|
142
|
+
return !self._client.should_buffer;
|
|
143
|
+
}
|
|
144
|
+
self._client.cork();
|
|
145
|
+
if (!callback) {
|
|
146
|
+
while (command_obj = self.queue.shift()) {
|
|
147
|
+
self._client.internal_send_command(command_obj);
|
|
148
|
+
}
|
|
149
|
+
self._client.uncork();
|
|
150
|
+
return !self._client.should_buffer;
|
|
151
|
+
}
|
|
152
|
+
var callback_without_own_cb = function (err, res) {
|
|
153
|
+
if (err) {
|
|
154
|
+
self.results.push(err);
|
|
155
|
+
// Add the position to the error
|
|
156
|
+
var i = self.results.length - 1;
|
|
157
|
+
self.results[i].position = i;
|
|
158
|
+
} else {
|
|
159
|
+
self.results.push(res);
|
|
160
|
+
}
|
|
161
|
+
// Do not emit an error here. Otherwise each error would result in one emit.
|
|
162
|
+
// The errors will be returned in the result anyway
|
|
163
|
+
};
|
|
164
|
+
var last_callback = function (cb) {
|
|
165
|
+
return function (err, res) {
|
|
166
|
+
cb(err, res);
|
|
167
|
+
callback(null, self.results);
|
|
168
|
+
};
|
|
169
|
+
};
|
|
170
|
+
self.results = [];
|
|
171
|
+
while (command_obj = self.queue.shift()) {
|
|
172
|
+
if (typeof command_obj.callback === 'function') {
|
|
173
|
+
command_obj.callback = batch_callback(self, command_obj.callback, index);
|
|
174
|
+
} else {
|
|
175
|
+
command_obj.callback = callback_without_own_cb;
|
|
176
|
+
}
|
|
177
|
+
if (typeof callback === 'function' && index === len - 1) {
|
|
178
|
+
command_obj.callback = last_callback(command_obj.callback);
|
|
179
|
+
}
|
|
180
|
+
this._client.internal_send_command(command_obj);
|
|
181
|
+
index++;
|
|
182
|
+
}
|
|
183
|
+
self._client.uncork();
|
|
184
|
+
return !self._client.should_buffer;
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
module.exports = Multi;
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// hgetall converts its replies to an Object. If the reply is empty, null is returned.
|
|
4
|
+
// These function are only called with internal data and have therefore always the same instanceof X
|
|
5
|
+
function replyToObject (reply) {
|
|
6
|
+
// The reply might be a string or a buffer if this is called in a transaction (multi)
|
|
7
|
+
if (reply.length === 0 || !(reply instanceof Array)) {
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
var obj = {};
|
|
11
|
+
for (var i = 0; i < reply.length; i += 2) {
|
|
12
|
+
obj[reply[i].toString('binary')] = reply[i + 1];
|
|
13
|
+
}
|
|
14
|
+
return obj;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function replyToStrings (reply) {
|
|
18
|
+
if (reply instanceof Buffer) {
|
|
19
|
+
return reply.toString();
|
|
20
|
+
}
|
|
21
|
+
if (reply instanceof Array) {
|
|
22
|
+
var res = new Array(reply.length);
|
|
23
|
+
for (var i = 0; i < reply.length; i++) {
|
|
24
|
+
// Recusivly call the function as slowlog returns deep nested replies
|
|
25
|
+
res[i] = replyToStrings(reply[i]);
|
|
26
|
+
}
|
|
27
|
+
return res;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return reply;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function print (err, reply) {
|
|
34
|
+
if (err) {
|
|
35
|
+
// A error always begins with Error:
|
|
36
|
+
console.log(err.toString());
|
|
37
|
+
} else {
|
|
38
|
+
console.log('Reply: ' + reply);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
var camelCase;
|
|
43
|
+
// Deep clone arbitrary objects with arrays. Can't handle cyclic structures (results in a range error)
|
|
44
|
+
// Any attribute with a non primitive value besides object and array will be passed by reference (e.g. Buffers, Maps, Functions)
|
|
45
|
+
// All capital letters are going to be replaced with a lower case letter and a underscore infront of it
|
|
46
|
+
function clone (obj) {
|
|
47
|
+
var copy;
|
|
48
|
+
if (Array.isArray(obj)) {
|
|
49
|
+
copy = new Array(obj.length);
|
|
50
|
+
for (var i = 0; i < obj.length; i++) {
|
|
51
|
+
copy[i] = clone(obj[i]);
|
|
52
|
+
}
|
|
53
|
+
return copy;
|
|
54
|
+
}
|
|
55
|
+
if (Object.prototype.toString.call(obj) === '[object Object]') {
|
|
56
|
+
copy = {};
|
|
57
|
+
var elems = Object.keys(obj);
|
|
58
|
+
var elem;
|
|
59
|
+
while (elem = elems.pop()) {
|
|
60
|
+
if (elem === 'tls') { // special handle tls
|
|
61
|
+
copy[elem] = obj[elem];
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
// Accept camelCase options and convert them to snake_case
|
|
65
|
+
var snake_case = elem.replace(/[A-Z][^A-Z]/g, '_$&').toLowerCase();
|
|
66
|
+
// If camelCase is detected, pass it to the client, so all variables are going to be camelCased
|
|
67
|
+
// There are no deep nested options objects yet, but let's handle this future proof
|
|
68
|
+
if (snake_case !== elem.toLowerCase()) {
|
|
69
|
+
camelCase = true;
|
|
70
|
+
}
|
|
71
|
+
copy[snake_case] = clone(obj[elem]);
|
|
72
|
+
}
|
|
73
|
+
return copy;
|
|
74
|
+
}
|
|
75
|
+
return obj;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function convenienceClone (obj) {
|
|
79
|
+
camelCase = false;
|
|
80
|
+
obj = clone(obj) || {};
|
|
81
|
+
if (camelCase) {
|
|
82
|
+
obj.camel_case = true;
|
|
83
|
+
}
|
|
84
|
+
return obj;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function callbackOrEmit (self, callback, err, res) {
|
|
88
|
+
if (callback) {
|
|
89
|
+
callback(err, res);
|
|
90
|
+
} else if (err) {
|
|
91
|
+
self.emit('error', err);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function replyInOrder (self, callback, err, res, queue) {
|
|
96
|
+
// If the queue is explicitly passed, use that, otherwise fall back to the offline queue first,
|
|
97
|
+
// as there might be commands in both queues at the same time
|
|
98
|
+
var command_obj;
|
|
99
|
+
/* istanbul ignore if: TODO: Remove this as soon as we test Redis 3.2 on travis */
|
|
100
|
+
if (queue) {
|
|
101
|
+
command_obj = queue.peekBack();
|
|
102
|
+
} else {
|
|
103
|
+
command_obj = self.offline_queue.peekBack() || self.command_queue.peekBack();
|
|
104
|
+
}
|
|
105
|
+
if (!command_obj) {
|
|
106
|
+
process.nextTick(function () {
|
|
107
|
+
callbackOrEmit(self, callback, err, res);
|
|
108
|
+
});
|
|
109
|
+
} else {
|
|
110
|
+
var tmp = command_obj.callback;
|
|
111
|
+
command_obj.callback = tmp ?
|
|
112
|
+
function (e, r) {
|
|
113
|
+
tmp(e, r);
|
|
114
|
+
callbackOrEmit(self, callback, err, res);
|
|
115
|
+
} :
|
|
116
|
+
function (e, r) {
|
|
117
|
+
if (e) {
|
|
118
|
+
self.emit('error', e);
|
|
119
|
+
}
|
|
120
|
+
callbackOrEmit(self, callback, err, res);
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
module.exports = {
|
|
126
|
+
reply_to_strings: replyToStrings,
|
|
127
|
+
reply_to_object: replyToObject,
|
|
128
|
+
print: print,
|
|
129
|
+
err_code: /^([A-Z]+)\s+(.+)$/,
|
|
130
|
+
monitor_regex: /^[0-9]{10,11}\.[0-9]+ \[[0-9]+ .+\]( ".+?")+$/,
|
|
131
|
+
clone: convenienceClone,
|
|
132
|
+
callback_or_emit: callbackOrEmit,
|
|
133
|
+
reply_in_order: replyInOrder
|
|
134
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "redis",
|
|
3
|
+
"version": "3.1.0",
|
|
4
|
+
"description": "A high performance Redis client.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"database",
|
|
7
|
+
"redis",
|
|
8
|
+
"transaction",
|
|
9
|
+
"pipelining",
|
|
10
|
+
"performance",
|
|
11
|
+
"queue",
|
|
12
|
+
"nodejs",
|
|
13
|
+
"pubsub",
|
|
14
|
+
"backpressure"
|
|
15
|
+
],
|
|
16
|
+
"author": "Matt Ranney <mjr@ranney.com>",
|
|
17
|
+
"contributors": [
|
|
18
|
+
{
|
|
19
|
+
"name": "Mike Diarmid (Salakar)",
|
|
20
|
+
"url": "https://github.com/salakar"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"name": "Ruben Bridgewater (BridgeAR)",
|
|
24
|
+
"url": "https://github.com/BridgeAR"
|
|
25
|
+
}
|
|
26
|
+
],
|
|
27
|
+
"license": "MIT",
|
|
28
|
+
"main": "./index.js",
|
|
29
|
+
"scripts": {
|
|
30
|
+
"coveralls": "nyc report --reporter=text-lcov | coveralls",
|
|
31
|
+
"coverage": "nyc report --reporter=html",
|
|
32
|
+
"benchmark": "node benchmarks/multi_bench.js",
|
|
33
|
+
"test": "nyc --cache mocha ./test/*.spec.js ./test/commands/*.spec.js --timeout=8000 && npm run coverage",
|
|
34
|
+
"lint": "eslint .",
|
|
35
|
+
"lint:fix": "eslint . --fix",
|
|
36
|
+
"lint:report": "eslint --output-file=eslint-report.json --format=json .",
|
|
37
|
+
"compare": "node benchmarks/diff_multi_bench_output.js beforeBench.txt afterBench.txt"
|
|
38
|
+
},
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"denque": "^1.5.0",
|
|
41
|
+
"redis-commands": "^1.7.0",
|
|
42
|
+
"redis-errors": "^1.2.0",
|
|
43
|
+
"redis-parser": "^3.0.0"
|
|
44
|
+
},
|
|
45
|
+
"engines": {
|
|
46
|
+
"node": ">=10"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"bluebird": "^3.7.2",
|
|
50
|
+
"coveralls": "^3.1.0",
|
|
51
|
+
"cross-spawn": "^7.0.3",
|
|
52
|
+
"eslint": "^7.21.0",
|
|
53
|
+
"intercept-stdout": "~0.1.2",
|
|
54
|
+
"metrics": "^0.1.21",
|
|
55
|
+
"mocha": "^8.3.0",
|
|
56
|
+
"nyc": "^15.1.0",
|
|
57
|
+
"prettier": "^2.2.1",
|
|
58
|
+
"tcp-port-used": "^1.0.1",
|
|
59
|
+
"uuid": "^8.3.2"
|
|
60
|
+
},
|
|
61
|
+
"repository": {
|
|
62
|
+
"type": "git",
|
|
63
|
+
"url": "git://github.com/NodeRedis/node-redis.git"
|
|
64
|
+
},
|
|
65
|
+
"bugs": {
|
|
66
|
+
"url": "https://github.com/NodeRedis/node-redis/issues"
|
|
67
|
+
},
|
|
68
|
+
"homepage": "https://github.com/NodeRedis/node-redis",
|
|
69
|
+
"directories": {
|
|
70
|
+
"example": "examples",
|
|
71
|
+
"test": "test"
|
|
72
|
+
},
|
|
73
|
+
"funding": {
|
|
74
|
+
"type": "opencollective",
|
|
75
|
+
"url": "https://opencollective.com/node-redis"
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2015 NodeRedis
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Redis Commands
|
|
2
|
+
|
|
3
|
+
[](https://travis-ci.org/NodeRedis/redis-commands)
|
|
4
|
+
[](https://codeclimate.com/github/NodeRedis/redis-commands)
|
|
5
|
+
[](https://codeclimate.com/github/NodeRedis/redis-commands/coverage)
|
|
6
|
+
|
|
7
|
+
This module exports all the commands that Redis supports.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```shell
|
|
12
|
+
$ npm install redis-commands
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```javascript
|
|
18
|
+
var commands = require('redis-commands');
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
`.list` is an array contains all the lowercased commands:
|
|
22
|
+
|
|
23
|
+
```javascript
|
|
24
|
+
commands.list.forEach(function (command) {
|
|
25
|
+
console.log(command);
|
|
26
|
+
});
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
`.exists()` is used to check if the command exists:
|
|
30
|
+
|
|
31
|
+
```javascript
|
|
32
|
+
commands.exists('set') // true
|
|
33
|
+
commands.exists('other-command') // false
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
`.hasFlag()` is used to check if the command has the flag:
|
|
37
|
+
|
|
38
|
+
```javascript
|
|
39
|
+
commands.hasFlag('set', 'readonly') // false
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
`.getKeyIndexes()` is used to get the indexes of keys in the command arguments:
|
|
43
|
+
|
|
44
|
+
```javascript
|
|
45
|
+
commands.getKeyIndexes('set', ['key', 'value']) // [0]
|
|
46
|
+
commands.getKeyIndexes('mget', ['key1', 'key2']) // [0, 1]
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Acknowledgment
|
|
50
|
+
|
|
51
|
+
Thank [@Yuan Chuan](https://github.com/yuanchuan) for the package name. The original redis-commands is renamed to [@yuanchuan/redis-commands](https://www.npmjs.com/package/@yuanchuan/redis-commands).
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
## v.1.7.0 - 6 Feb, 2021
|
|
2
|
+
|
|
3
|
+
Features
|
|
4
|
+
|
|
5
|
+
- Updated commands list to Redis 6.2
|
|
6
|
+
|
|
7
|
+
## v.1.6.0 - 25 Jul, 2020
|
|
8
|
+
|
|
9
|
+
Features
|
|
10
|
+
|
|
11
|
+
- Updated commands list to Redis 6.06
|
|
12
|
+
|
|
13
|
+
## v.1.5.0 - 10 May, 2019
|
|
14
|
+
|
|
15
|
+
Features
|
|
16
|
+
|
|
17
|
+
- Updated the commands list
|
|
18
|
+
- Added support for `XREAD` and `XREADGROUP` in `.getKeyIndexes()`
|
|
19
|
+
|
|
20
|
+
## v.1.4.0 - 8 Oct, 2018
|
|
21
|
+
|
|
22
|
+
Features
|
|
23
|
+
|
|
24
|
+
- Updated the commands list
|
|
25
|
+
|
|
26
|
+
## v.1.3.5 - 28 Feb, 2018
|
|
27
|
+
|
|
28
|
+
Bugfix
|
|
29
|
+
|
|
30
|
+
- Rebuild the commands with the latest stable release.
|
|
31
|
+
In v.1.3.3 the wrong Redis version was used.
|
|
32
|
+
|
|
33
|
+
## v.1.3.4 - 26 Feb, 2018
|
|
34
|
+
|
|
35
|
+
Chore
|
|
36
|
+
|
|
37
|
+
- Removed coverage folder from npm
|
|
38
|
+
|
|
39
|
+
## v.1.3.3 - 24 Feb, 2018
|
|
40
|
+
|
|
41
|
+
Features
|
|
42
|
+
|
|
43
|
+
- Rebuild the commands
|
|
44
|
+
|
|
45
|
+
## v.1.3.2 - 24 Feb, 2018
|
|
46
|
+
|
|
47
|
+
Chore
|
|
48
|
+
|
|
49
|
+
- Updated dependencies
|
|
50
|
+
- Fixed typos
|
|
51
|
+
|
|
52
|
+
## v.1.3.1 - 25 Jan, 2017
|
|
53
|
+
|
|
54
|
+
Bugfix
|
|
55
|
+
|
|
56
|
+
- Fix require for for webpack
|
|
57
|
+
|
|
58
|
+
## v.1.3.0 - 20 Oct, 2016
|
|
59
|
+
|
|
60
|
+
Features
|
|
61
|
+
|
|
62
|
+
- Rebuild the commands with the newest Redis unstable release
|
|
63
|
+
|
|
64
|
+
## v.1.2.0 - 21 Apr, 2016
|
|
65
|
+
|
|
66
|
+
Features
|
|
67
|
+
|
|
68
|
+
- Added support for `MIGRATE [...] KEYS key1, key2` (Redis >= v.3.0.6)
|
|
69
|
+
- Added build sanity check for unhandled commands with moveable keys
|
|
70
|
+
- Rebuild the commands with the newest unstable release
|
|
71
|
+
- Improved performance of .getKeyIndexes()
|
|
72
|
+
|
|
73
|
+
Bugfix
|
|
74
|
+
|
|
75
|
+
- Fixed command command returning the wrong arity due to a Redis bug
|
|
76
|
+
- Fixed brpop command returning the wrong keystop due to a Redis bug
|
|
77
|
+
|
|
78
|
+
## v.1.1.0 - 09 Feb, 2016
|
|
79
|
+
|
|
80
|
+
Features
|
|
81
|
+
|
|
82
|
+
- Added .exists() to check for command existence
|
|
83
|
+
- Improved performance of .hasFlag()
|