This is extremely experimental stuff
This is a simple "shared storage" for nodejs cluster without redis-like daemon.
- set/get/del/exists/incr/decr/incrby/decrby/keys
- hset/hget/hdel/hexists/hincrby/hlen/hkeys/hvals/hgetall
- echo/flushall/flushdb
- TODO: ....
- see also redis command reference for supported commands
npm install noredis
or
npm install [email protected]:iolo/node-noredis.git
- do
require('noredis')
before fork the first worker. - use noredis in workers.
- that's all folks.
var cluster = require('cluster'),
noredis = require('noredis'); // NOTE: before the first fork!
if (cluster.isMaster()) {
...
cluster.fork();
...
} else {
...
noredis.set('foo', 123);
noredis.get('foo', function(err, reply) {
console.log('foo is ' + reply);
});
}
- see also examples/cluster.js
- simply
require('noredis')
and use it. - that's all ;)
var noredis = require('noredis');
...
noredis.set('foo', 123);
noredis.get('foo', function(err, reply) {
console.log('foo is ' + reply);
});
- see also examples/nocluster.js