Skip to content

Commit

Permalink
docs: update docs for sendCommand
Browse files Browse the repository at this point in the history
  • Loading branch information
luin committed Mar 31, 2022
1 parent 92e7cd9 commit 2f3f98f
Showing 1 changed file with 6 additions and 16 deletions.
22 changes: 6 additions & 16 deletions lib/Redis.ts
Expand Up @@ -376,26 +376,16 @@ class Redis extends Commander {
/**
* Send a command to Redis
*
* This method is used internally by the `Redis#set`, `Redis#lpush` etc.
* Most of the time you won't invoke this method directly.
* However when you want to send a command that is not supported by ioredis yet,
* this command will be useful.
* This method is used internally and in most cases you should not
* use it directly. If you need to send a command that is not supported
* by the library, you can use the `call` method:
*
* ```js
* const redis = new Redis();
*
* // Use callback
* const get = new Command('get', ['foo'], 'utf8', function (err, result) {
* console.log(result);
* });
* redis.sendCommand(get);
*
* // Use promise
* const set = new Command('set', ['foo', 'bar'], 'utf8');
* set.promise.then(function (result) {
* console.log(result);
* });
* redis.sendCommand(set);
* redis.call('set', 'foo', 'bar');
* // or
* redis.call(['set', 'foo', 'bar']);
* ```
*
* @ignore
Expand Down

0 comments on commit 2f3f98f

Please sign in to comment.