How to use ioredis

Comprehensive ioredis code examples:

How to use ioredis.Command:

19
20
21
22
23
24
25
26
27
28
// A single query returns an array with up to 3 elements:
//  - the column names for each result
//  - an array of result objects
//  - some meta information about the query
// A single result can be a node, relation, or scalar in the case of something like (id(node))
Redis.Command.setReplyTransformer('GRAPH.QUERY', function (result) {
  let metaInformation = parseMetaInformation(result.pop())

  let parsedResults = []
  parsedResults.meta = metaInformation

How to use ioredis.set:

49
50
51
52
53
54
55
56
57
58
function get(url) {
  return request('get', url).end();
}

function cache(res) {
  return db.set(res.url, res.body);
}

po(get, cache)('http://weo.io').then(function() {
  //...

How to use ioredis.default:

2
3
4
5
6
7
8
9
10
11
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const ioredis_1 = __importDefault(require("ioredis"));
const common_1 = require("../common.js");
const redis = new ioredis_1.default();
exports.default = {
    getBinanceSymbol,
    setBinanceSymbol,
    getBitcomInstrument,