forked from joaojeronimo/node_redis_cluster
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.js
More file actions
36 lines (29 loc) · 714 Bytes
/
example.js
File metadata and controls
36 lines (29 loc) · 714 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
var rcluster = require('./index.js').clusterClient;
new rcluster.clusterInstance('127.0.0.1:7001', function (err, r) {
if (err) throw err;
r.hmset('hset:1', {a:1,b:2,c:'hello'}, function(e,d){
console.log(e,d);
});
function doIt() {
r.set('foo', 'bar', function (err, reply) {
if (err) throw err;
r.get('foo', function (err, reply) {
if (err) throw err;
console.log(err, reply);
});
});
r.hgetall('hset:1', function(e, d){
console.log(e,d);
});
try {
console.log('hmget');
r.hmget('hset:1', 'a', 'b', 'f', function(e, d){
console.log('hmget',e,d);
});
} catch(e) {
console.log('exception', e, e.stack)
}
setTimeout(doIt, 5000);
}
doIt();
});