mirror of
https://codeberg.org/tacerus/teddit.git
synced 2025-01-08 12:22:33 +01:00
1.5 KiB
1.5 KiB
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.