How to use the ioredis.Command function in ioredis

To help you get started, we’ve selected a few ioredis examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github seerline / clchart / cs / server.js View on Github external
function from_client_to_server (message, argv) {
  message.id = argv[0]
  let com = argv[1]
  let param = argv.slice(2)

  console.log(param)
  let command = new class_redis_command(com, param, // {},
    {
      replyEncoding: 'utf8'
    },
    function (error, result) {
      console.log(':::', typeof result, result, arguments.length)
      from_server_to_client(message, result)
      for (var i = 0; i < arguments.length; i++) {
        console.log(i, '--------:' + arguments[i])
      }
    })
  server.redis_server.sendCommand(command)
  }
github iopipe / iopipe-js-trace / src / plugins / ioredis.js View on Github external
function unwrap() {
  if (process.env.IOPIPE_TRACE_IOREDIS_INITPROMISE) {
    shimmer.unwrap(Redis.Command && Redis.Command.prototype, 'initPromise');
  }
  shimmer.unwrap(Redis && Redis.prototype, 'sendCommand');
  delete Redis.__iopipeShimmer;
}
github strongloop / loopback-connector-kv-redis / lib / kv-redis.js View on Github external
RedisKeyValueConnector.prototype.execute = function(command, args, cb) {
  if (cb === undefined && typeof args === 'function') {
    cb = args;
    args = [];
  }

  assert(typeof command === 'string', 'command must be a string');
  assert(typeof cb === 'function', 'callback must be a function');

  command = command.toLowerCase();

  debug('EXECUTE %j %j', command, args);
  const cmd = new Redis.Command(command, args, 'utf8', function(err, result) {
    debug('RESULT OF %j -- %j', command, result);
    cb(err, result);
  });
  this._client.sendCommand(cmd);
};
github iopipe / iopipe-js-trace / src / plugins / ioredis.js View on Github external
function wrap({ timeline, data = {} } = {}) {
  if (!(timeline instanceof Perf)) {
    debug(
      'Timeline passed to plugins/ioredis.wrap not an instance of performance-node. Skipping.'
    );
    return false;
  }

  if (!Redis.__iopipeShimmer) {
    if (process.env.IOPIPE_TRACE_IOREDIS_INITPROMISE) {
      shimmer.wrap(
        Redis.Command && Redis.Command.prototype,
        'initPromise',
        wrapPromise
      );
    }
    shimmer.wrap(Redis && Redis.prototype, 'sendCommand', wrapSendCommand);
    Redis.__iopipeShimmer = true;
  }

  return true;

  function wrapPromise(original) {
    return function wrappedPromise() {
      const command = this;
      const cb = this.callback;
      const id = createId();
      const { name } = command;

ioredis

A robust, performance-focused and full-featured Redis client for Node.js.

MIT
Latest version published 7 months ago

Package Health Score

88 / 100
Full package analysis