This documentation is not maintained. Please refer to doc.castsoftware.com/technologies to find the latest updates.

CAST supports Redis via its com.castsoftware.nodejs extension. Details about how this support is provided for Node.js source code is discussed below.

Supported Redis clients

  • redis
  • ioredis
  • redis-fast-driver
  • then-redis

Objects

Icon

Description

Node.js Redis Connection

Node.js Redis Collection

Node.js unknown Redis Connection

Node.js Unknown Redis Collection

What results can you expect?

Some example scenarios are shown below:

const redis = require("redis");
var client = redis.createClient('16', '192.168.1.52');

const hash_key = "hash key"
client0.set("string key", "string val", redis.print);

client0.hset(hash_key, "hashtest 1", "some value", redis.print);
client0.hset(["hash key", "hashtest 2", "some other value"], redis.print);

client0.get("string key", redis.print);
client0.get(new Buffer("hash key"), redis.print);

client0.rpush(['frameworks', 'angularjs', 'backbone'], function(err, reply) {
    console.log(reply); //prints 2
});

client0.lrange('frameworks', 0, -1, function(err, reply) {
    console.log(reply); // ['angularjs', 'backbone']
});