Open
Description
Motivation
The Cluster client should provide overrides for specific Redis Core and module commands to make them easy to use with OS Cluster API.
- Provide an abstraction that handles
FT.AGGREGATE
and executesFT.CURSOR READ
orFT.CURSOR DEL
on the correct node (on the node where FT.AGGREGATE was executed) automatically - Commands that should be executed on primaries with Round-robin load balancing/scheduling
- Commands that should be broadcasted to all primaries
- JSON.MGET:
import { createCluster } from 'redis';
const cluster = createCluster({
rootNodes: [
// ...
]
});
cluster.on('error', (err) => console.log('Redis Cluster Error', err));
await cluster.connect();
await cluster.json.set('doc1', '$', {
name: 'Alice',
age: 32,
coins: 100,
email: 'alice@nonexist.com'
})
await cluster.json.set('doc2', '$', {
name: 'Bob',
age: 23,
coins: 15,
email: 'bob@somewhere.gov'
})
// Both mget commands should return all documents from cluster
console.log(await cluster.json.mGet(['doc1', 'doc2'], '$..name'))
console.log(await cluster.json.mGet(['doc2', 'doc1'], '$..name'))
Basic Code Example
No response