note store option
This commit is contained in:
parent
f07410bc14
commit
2850be580a
11
README.md
11
README.md
@ -20,9 +20,10 @@ npm install --save memstore-cluster@2.x
|
|||||||
v1.x vs v2.x
|
v1.x vs v2.x
|
||||||
------------
|
------------
|
||||||
|
|
||||||
The old v1 used `ws` which makes it usable when clustering node processes without using `cluster`.
|
The [old v1](https://github.com/coolaj86/cluster-store/tree/v1.x)
|
||||||
|
used `ws` which makes it usable when clustering node processes without using `cluster`.
|
||||||
|
|
||||||
If you need that functionaliy, use it.
|
If you need that functionaliy, use v1 instead of v2.
|
||||||
|
|
||||||
Usage
|
Usage
|
||||||
=====
|
=====
|
||||||
@ -45,6 +46,7 @@ var cluster = require('cluster');
|
|||||||
|
|
||||||
var cstore = require('cluster-store/master').create({
|
var cstore = require('cluster-store/master').create({
|
||||||
name: 'foo-store'
|
name: 'foo-store'
|
||||||
|
, store: null // use default in-memory store
|
||||||
});
|
});
|
||||||
|
|
||||||
cstore.addWorker(cluster.fork());
|
cstore.addWorker(cluster.fork());
|
||||||
@ -54,6 +56,11 @@ cstore.then(function (store) {
|
|||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Note: `store` can be replaced with any `express/session` store, such as:
|
||||||
|
* `new require('express-session/session/memory')()`
|
||||||
|
* `require('level-session-store')(session)`
|
||||||
|
* and others
|
||||||
|
|
||||||
### worker
|
### worker
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
|
Loading…
x
Reference in New Issue
Block a user