Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/adriano-di-giovanni/node-redis-commands
A Node.js module reporting all commands implemented by Redis.
https://github.com/adriano-di-giovanni/node-redis-commands
Last synced: 1 day ago
JSON representation
A Node.js module reporting all commands implemented by Redis.
- Host: GitHub
- URL: https://github.com/adriano-di-giovanni/node-redis-commands
- Owner: adriano-di-giovanni
- Created: 2015-05-17T16:48:43.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-06-22T07:58:25.000Z (over 9 years ago)
- Last Synced: 2024-11-01T06:47:39.293Z (13 days ago)
- Language: JavaScript
- Size: 141 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# node-redis-commands
A Node.js module reporting all commands implemented by Redis.
The module gives you access to
* a [compiled report](#compiledReport)
* and a [reporting function](#reportingFunction).Reports contain info from Redis [COMMAND](http://redis.io/commands/command) plus data types each command operates on (if applicable).
I developed it as a utility for managing key-to-client binding in [node-redis-keychain](https://github.com/adriano-di-giovanni/node-redis-keychain).
## Installation
```
npm install node-redis-commands
```## Usage
```javascript
var
commands = require('node-redis-commands').commands;console.log(commands.get); // output below
/*
{ name: 'get',
arity: 2,
flags: [ 'readonly', 'fast' ],
firstKeyAt: 1,
lastKeyAt: 1,
step: 1,
types: [ 'string' ] }
*/
```Reporting function issues a [COMMAND](http://redis.io/commands/command) on a Redis client instance and returns the same list of commands of the compiled report.
This module is client agnostic: you can use your library of choice as long as it exposes both [INFO](http://redis.io/commands/info) and [COMMAND](http://redis.io/commands/command) commands.
```javascript
// module deps
var
Redis = require('ioredis');
report = require('node-redis-commands').report;var
client = new Redis(),
callback = function (error, version, commands) {client.disconnect();
if (error) {
throw error;
}console.log(commands.get); // output below
/*
{ name: 'get',
arity: 2,
flags: [ 'readonly', 'fast' ],
firstKeyAt: 1,
lastKeyAt: 1,
step: 1,
types: [ 'string' ] }
*/
};report(client, callback);
```If you prefer having the list returned as an array
```javascript
// module deps
var
Redis = require('ioredis');
report = require('node-redis-commands').report;var
client = new Redis(),
asArray = true,
callback = function (error, version, commands) {client.disconnect();
if (error) {
throw error;
}console.log(commands[0]); // output below
/*
{ name: 'hlen',
arity: 2,
flags: [ 'readonly', 'fast' ],
firstKeyAt: 1,
lastKeyAt: 1,
step: 1,
types: [ 'set' ] }
*/
};report(client, asArray, callback);
```## Change Log
### 0.1.5 (2015-06-22)
Fix redis issue [#2598](https://github.com/antirez/redis/issues/2598)
### 0.1.4
Fix type for commands operating on keys of type hash
### 0.1.3
Update compiled report to Redis 3.0.1
### 0.1.2
Just changed package definition
### 0.1.1
Added `Type` constants
### 0.1.0
Initial release