mirror of
https://codeberg.org/tacerus/teddit.git
synced 2024-11-29 11:19:22 +01:00
.. | ||
tools | ||
changelog.md | ||
commands.json | ||
index.js | ||
LICENSE | ||
package.json | ||
README.md |
Redis Commands
This module exports all the commands that Redis supports.
Install
$ npm install redis-commands
Usage
var commands = require('redis-commands');
.list
is an array contains all the lowercased
commands:
.list.forEach(function (command) {
commandsconsole.log(command);
; })
.exists()
is used to check if the command exists:
.exists('set') // true
commands.exists('other-command') // false commands
.hasFlag()
is used to check if the command has the
flag:
.hasFlag('set', 'readonly') // false commands
.getKeyIndexes()
is used to get the indexes of keys in
the command arguments:
.getKeyIndexes('set', ['key', 'value']) // [0]
commands.getKeyIndexes('mget', ['key1', 'key2']) // [0, 1] commands
Acknowledgment
Thank @Yuan Chuan for the package name. The original redis-commands is renamed to @yuanchuan/redis-commands.