cloudcms-server 3.3.1-beta.9 → 4.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +1 -1
- package/broadcast/broadcast.js +6 -3
- package/broadcast/providers/redis.js +24 -49
- package/clients/nrp.js +117 -0
- package/clients/redis.js +64 -0
- package/d1/index.js +629 -0
- package/d1/index.js.works +203 -0
- package/d1/package.json +86 -0
- package/d1/package.json.works +14 -0
- package/duster/helpers/sample/nyt.js +2 -1
- package/framework/controllers.js +4 -4
- package/index.js +21 -14
- package/insight/insight.js +1 -1
- package/launchpad/index.js +203 -11
- package/launchpad/launchers/cluster.js +103 -110
- package/launchpad/launchers/redis.js +70 -0
- package/launchpad/launchers/single.js +36 -22
- package/locks/locks.js +63 -9
- package/locks/providers/cluster.js +3 -1
- package/locks/providers/memory.js +10 -7
- package/locks/providers/redis.js +62 -82
- package/middleware/admin/admin.js +3 -3
- package/middleware/authentication/adapters/session.js +11 -8
- package/middleware/authentication/authentication.js +28 -16
- package/middleware/authentication/authenticators/default.js +5 -2
- package/middleware/authentication/authenticators/session.js +5 -2
- package/middleware/authentication/providers/saml.js +1 -1
- package/middleware/authorization/authorization.js +11 -8
- package/middleware/awareness/awareness.js +55 -31
- package/middleware/awareness/plugins/editorial.js +4 -4
- package/middleware/awareness/providers/abstract-async.js +107 -84
- package/middleware/awareness/providers/abstract.js +1 -1
- package/middleware/awareness/providers/memory.js +0 -14
- package/middleware/awareness/providers/redis.js +186 -279
- package/middleware/cache/cache.js +4 -2
- package/middleware/cache/providers/redis.js +127 -89
- package/middleware/cache/providers/shared-memory.js +3 -3
- package/middleware/cloudcms/cloudcms.js +22 -16
- package/middleware/form/form.js +3 -3
- package/middleware/modules/modules.js +6 -3
- package/middleware/proxy/proxy.js +8 -21
- package/middleware/stores/stores.js +2 -2
- package/middleware/virtual-config/virtual-config.js +11 -8
- package/middleware/wcm/wcm.js +4 -4
- package/notifications/notifications.js +2 -2
- package/package.json +29 -25
- package/server/index.js +504 -415
- package/server/standalone.js +9 -0
- package/temp/clusterlock/index.js +3 -3
- package/temp/clusterlock/package.json +1 -1
- package/temp/passport-saml/LICENSE +23 -0
- package/temp/passport-saml/README.md +406 -0
- package/temp/passport-saml/lib/node-saml/algorithms.d.ts +5 -0
- package/temp/passport-saml/lib/node-saml/algorithms.js +41 -0
- package/temp/passport-saml/lib/node-saml/algorithms.js.map +1 -0
- package/temp/passport-saml/lib/node-saml/index.d.ts +3 -0
- package/temp/passport-saml/lib/node-saml/index.js +6 -0
- package/temp/passport-saml/lib/node-saml/index.js.map +1 -0
- package/temp/passport-saml/lib/node-saml/inmemory-cache-provider.d.ts +45 -0
- package/temp/passport-saml/lib/node-saml/inmemory-cache-provider.js +86 -0
- package/temp/passport-saml/lib/node-saml/inmemory-cache-provider.js.map +1 -0
- package/temp/passport-saml/lib/node-saml/saml-post-signing.d.ts +3 -0
- package/temp/passport-saml/lib/node-saml/saml-post-signing.js +15 -0
- package/temp/passport-saml/lib/node-saml/saml-post-signing.js.map +1 -0
- package/temp/passport-saml/lib/node-saml/saml.d.ts +77 -0
- package/temp/passport-saml/lib/node-saml/saml.js +1170 -0
- package/temp/passport-saml/lib/node-saml/saml.js.map +1 -0
- package/temp/passport-saml/lib/node-saml/types.d.ts +95 -0
- package/temp/passport-saml/lib/node-saml/types.js +8 -0
- package/temp/passport-saml/lib/node-saml/types.js.map +1 -0
- package/temp/passport-saml/lib/node-saml/utility.d.ts +3 -0
- package/temp/passport-saml/lib/node-saml/utility.js +19 -0
- package/temp/passport-saml/lib/node-saml/utility.js.map +1 -0
- package/temp/passport-saml/lib/node-saml/xml.d.ts +21 -0
- package/temp/passport-saml/lib/node-saml/xml.js +140 -0
- package/temp/passport-saml/lib/node-saml/xml.js.map +1 -0
- package/temp/passport-saml/lib/passport-saml/index.d.ts +6 -0
- package/temp/passport-saml/lib/passport-saml/index.js +11 -0
- package/temp/passport-saml/lib/passport-saml/index.js.map +1 -0
- package/temp/passport-saml/lib/passport-saml/multiSamlStrategy.d.ts +13 -0
- package/temp/passport-saml/lib/passport-saml/multiSamlStrategy.js +63 -0
- package/temp/passport-saml/lib/passport-saml/multiSamlStrategy.js.map +1 -0
- package/temp/passport-saml/lib/passport-saml/strategy.d.ts +20 -0
- package/temp/passport-saml/lib/passport-saml/strategy.js +167 -0
- package/temp/passport-saml/lib/passport-saml/strategy.js.map +1 -0
- package/temp/passport-saml/lib/passport-saml/types.d.ts +51 -0
- package/temp/passport-saml/lib/passport-saml/types.js +11 -0
- package/temp/passport-saml/lib/passport-saml/types.js.map +1 -0
- package/temp/passport-saml/package.json +96 -0
- package/util/auth.js +6 -6
- package/util/cloudcms.js +85 -88
- package/util/proxy-factory.js +159 -268
- package/util/redis.js +113 -0
- package/util/renditions.js +12 -6
- package/util/request.js +4 -4
- package/util/util.js +16 -2
- package/launchpad/launchers/sticky-cluster.js +0 -43
- package/temp/memored/.jshintrc +0 -4
- package/temp/memored/README.md +0 -240
- package/temp/memored/demo/demo1.js +0 -37
- package/temp/memored/demo/demo2.js +0 -32
- package/temp/memored/gulpfile.js +0 -8
- package/temp/memored/index.js +0 -343
- package/temp/memored/package.json +0 -54
- package/temp/memored/spec/memored.spec.js +0 -265
- package/web/cms/ice.js +0 -109
- package/web/cms/preview.js +0 -106
package/util/request.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
var axios = require("axios");
|
|
2
2
|
|
|
3
|
-
var http = require("http");
|
|
4
|
-
var https = require("https");
|
|
5
|
-
|
|
6
|
-
var FormData = require("form-data");
|
|
3
|
+
// var http = require("http");
|
|
4
|
+
// var https = require("https");
|
|
5
|
+
//
|
|
6
|
+
// var FormData = require("form-data");
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Incoming config:
|
package/util/util.js
CHANGED
|
@@ -603,7 +603,7 @@ var executeFunction = exports.executeFunction = function(identifier, fn, afterFn
|
|
|
603
603
|
// take out a lock to ensure that the first thread to pass through here is the only one
|
|
604
604
|
// and gets to run by itself on the cluster
|
|
605
605
|
var exclusiveLockKey = "exclusiveLock-" + identifier;
|
|
606
|
-
process.locks.lock(exclusiveLockKey, function (releaseLockFn) {
|
|
606
|
+
process.locks.lock(exclusiveLockKey, function (err, releaseLockFn) {
|
|
607
607
|
|
|
608
608
|
var firstRunCacheKey = "firstRun-" + identifier;
|
|
609
609
|
process.cache.read(firstRunCacheKey, function(err, value) {
|
|
@@ -1777,10 +1777,11 @@ var zip = exports.zip = function(directoryPath, writableStream)
|
|
|
1777
1777
|
* @param {string} protocol
|
|
1778
1778
|
* @param {string} host
|
|
1779
1779
|
* @param [number|string] port
|
|
1780
|
+
* @param {string} path
|
|
1780
1781
|
*
|
|
1781
1782
|
* @type {Function}
|
|
1782
1783
|
*/
|
|
1783
|
-
var asURL = exports.asURL = function(protocol, host, port)
|
|
1784
|
+
var asURL = exports.asURL = function(protocol, host, port, path)
|
|
1784
1785
|
{
|
|
1785
1786
|
// protocol lower case
|
|
1786
1787
|
protocol = protocol.toLowerCase();
|
|
@@ -1806,6 +1807,19 @@ var asURL = exports.asURL = function(protocol, host, port)
|
|
|
1806
1807
|
}
|
|
1807
1808
|
}
|
|
1808
1809
|
|
|
1810
|
+
// include url "path" if defined
|
|
1811
|
+
if (path) {
|
|
1812
|
+
path = '/' + path;
|
|
1813
|
+
path = path.replace(/\/+/g, '/'); // ensure no extra '/' characters
|
|
1814
|
+
if (path.endsWith('/')) {
|
|
1815
|
+
// remove trailing '/' character
|
|
1816
|
+
path = path.substring(0, path.length - 1);
|
|
1817
|
+
}
|
|
1818
|
+
if (path) {
|
|
1819
|
+
url += path;
|
|
1820
|
+
}
|
|
1821
|
+
}
|
|
1822
|
+
|
|
1809
1823
|
return url;
|
|
1810
1824
|
};
|
|
1811
1825
|
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
var clusterlock = require("../../temp/clusterlock");
|
|
2
|
-
|
|
3
|
-
// use sticky-session library
|
|
4
|
-
var sticky = require('sticky-session');
|
|
5
|
-
|
|
6
|
-
module.exports = function(options) {
|
|
7
|
-
|
|
8
|
-
var factoryCallback = options.factory;
|
|
9
|
-
var reportCallback = options.report;
|
|
10
|
-
if (!reportCallback)
|
|
11
|
-
{
|
|
12
|
-
reportCallback = function () {
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
var completionCallback = options.complete;
|
|
16
|
-
if (!completionCallback)
|
|
17
|
-
{
|
|
18
|
-
completionCallback = function () {
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
factoryCallback(function (server) {
|
|
23
|
-
|
|
24
|
-
if (!sticky.listen(server, server._listenPort))
|
|
25
|
-
{
|
|
26
|
-
// master code
|
|
27
|
-
|
|
28
|
-
// start up cluster locks
|
|
29
|
-
clusterlock.setup();
|
|
30
|
-
|
|
31
|
-
// wait 5 seconds, then fire callbacks
|
|
32
|
-
setTimeout(function () {
|
|
33
|
-
reportCallback();
|
|
34
|
-
completionCallback();
|
|
35
|
-
}, 5000);
|
|
36
|
-
}
|
|
37
|
-
else
|
|
38
|
-
{
|
|
39
|
-
// worker code
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
});
|
|
43
|
-
};
|
package/temp/memored/.jshintrc
DELETED
package/temp/memored/README.md
DELETED
|
@@ -1,240 +0,0 @@
|
|
|
1
|
-
# Memored
|
|
2
|
-
|
|
3
|
-
Memored implements an in-memory shared cache to use in nodejs applications which uses [cluster](http://nodejs.org/api/cluster.html) module.
|
|
4
|
-
|
|
5
|
-
Let's say you want your application to take advantage of multi-core CPUs using nodejs cluster module; you will be able to run several _isolated_ processes which shared nothing but a communication channel with parent process.
|
|
6
|
-
If you need a fast volatile cache, common solutions would create an in-memory map for every process you run, so you end up with the same data stored several times in your machine RAM.
|
|
7
|
-
|
|
8
|
-
Memored uses communication channel between master process and its workers to use a unique in-memory storage, reducing the amount of memory your application would use.
|
|
9
|
-
|
|
10
|
-
## Getting Started
|
|
11
|
-
Install this module with _npm_:
|
|
12
|
-
```javascript
|
|
13
|
-
npm install memored
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
Store and read values is straightforward:
|
|
17
|
-
```javascript
|
|
18
|
-
var cluster = require('cluster'),
|
|
19
|
-
memored = require('memored');
|
|
20
|
-
|
|
21
|
-
if (cluster.isMaster) {
|
|
22
|
-
cluster.fork();
|
|
23
|
-
} else {
|
|
24
|
-
var han = {
|
|
25
|
-
firstname: 'Han',
|
|
26
|
-
lastname: 'Solo'
|
|
27
|
-
},
|
|
28
|
-
luke = {
|
|
29
|
-
firstname: 'Luke',
|
|
30
|
-
lastname: 'Skywalker'
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
// Store and read
|
|
34
|
-
memored.store('character1', han, function() {
|
|
35
|
-
console.log('Value stored!');
|
|
36
|
-
|
|
37
|
-
memored.read('character1', function(err, value) {
|
|
38
|
-
console.log('Read value:', value);
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
// You can also set a ttl (milliseconds)
|
|
43
|
-
memored.store('character2', luke, 1000, function(err, expirationTime) {
|
|
44
|
-
console.log('Value stored until:', new Date(expirationTime));
|
|
45
|
-
|
|
46
|
-
setTimeout(function() {
|
|
47
|
-
memored.read('character2', function(err, value) {
|
|
48
|
-
console.log('Value is gone?', value === undefined);
|
|
49
|
-
|
|
50
|
-
process.exit();
|
|
51
|
-
});
|
|
52
|
-
}, 1050);
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
## Invalidation management
|
|
58
|
-
By default, _memored_ will evict cache entries (stored with _ttl_) passively. This is, when you read an expired entry, you will get no value on return and _memored_ will delete the value from its internal cache.
|
|
59
|
-
|
|
60
|
-
You can also configure _memored_ to actively evict expired entries every N milliseconds. For this to work, you need to pass the attribute *purgeInterval* to the *setup* function.
|
|
61
|
-
This will trigger an internal function which looks for expired entries and deletes them from its internal cache.
|
|
62
|
-
|
|
63
|
-
Example:
|
|
64
|
-
```javascript
|
|
65
|
-
var cluster = require('cluster'),
|
|
66
|
-
async = require('async'),
|
|
67
|
-
memored = require('memored');
|
|
68
|
-
|
|
69
|
-
if (cluster.isMaster) {
|
|
70
|
-
|
|
71
|
-
cluster.fork();
|
|
72
|
-
memored.setup({ purgeInterval: 500});
|
|
73
|
-
|
|
74
|
-
} else {
|
|
75
|
-
|
|
76
|
-
async.series({
|
|
77
|
-
storeValue: function(next) {
|
|
78
|
-
memored.store('key1', 'My simple string value', 100, next);
|
|
79
|
-
},
|
|
80
|
-
readCacheSize: function(next) {
|
|
81
|
-
memored.size(function(err, size) {
|
|
82
|
-
console.log('Current size is 1?', size === 1);
|
|
83
|
-
next();
|
|
84
|
-
});
|
|
85
|
-
},
|
|
86
|
-
wait: function(next) {
|
|
87
|
-
setTimeout(next, 600);
|
|
88
|
-
},
|
|
89
|
-
readCacheSizeAgain: function(next) {
|
|
90
|
-
memored.size(function(err, size) {
|
|
91
|
-
console.log('Current size is 0?', size === 0);
|
|
92
|
-
next();
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
}, process.exit);
|
|
96
|
-
}
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
## API
|
|
100
|
-
Documentation for every module function:
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
### setup(options)
|
|
104
|
-
|
|
105
|
-
This function is used to configure _memored_.
|
|
106
|
-
|
|
107
|
-
**Arguments**:
|
|
108
|
-
|
|
109
|
-
- **purgeInterval** {Number} (optional): Configures and triggers _memored_ expired entries auto deletion. Value expressed in milliseconds. _It's only used when called this method from the master process of your application_.
|
|
110
|
-
- **logger** {Object} (optional): In you want _memored_ to log something, you must provide an object implementing *log* and *warn* functions.
|
|
111
|
-
|
|
112
|
-
**Example**:
|
|
113
|
-
```javascript
|
|
114
|
-
memored.setup({
|
|
115
|
-
purgeInterval: 15000,
|
|
116
|
-
logger: console
|
|
117
|
-
});
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
### store(key, value, [ttl], callback)
|
|
121
|
-
|
|
122
|
-
This function stores a value in the cache.
|
|
123
|
-
_It is intended to be called from a worker process_.
|
|
124
|
-
|
|
125
|
-
**Arguments**:
|
|
126
|
-
|
|
127
|
-
- **key** {String} (required): Key used to lookup the entry
|
|
128
|
-
- **value** {Mixed} (required): Whatever you want to store
|
|
129
|
-
- **ttl** {Number} (optional): Time to live for this value in the cache (milliseconds)
|
|
130
|
-
- **callback** {Function} (optional): Function to be call on store completion. Callback arguments:
|
|
131
|
-
- _err_ {Error}: Optional error
|
|
132
|
-
- _expirationTime_ {Number}: The timestamp of the moment when this entry will expire. If _ttl_ is not used, this value will be undefined.
|
|
133
|
-
|
|
134
|
-
**Examples**:
|
|
135
|
-
```javascript
|
|
136
|
-
memored.store('key1', {firstname: 'Han', lastname: 'Solo'}, function() {
|
|
137
|
-
console.log('Value stored!');
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
memored.store('key2', ['a', 'b', 'c'], 15000, function(err, expirationTime) {
|
|
141
|
-
console.log('This value will expire on:', new Date(expirationTime));
|
|
142
|
-
});
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
### read(key, callback)
|
|
146
|
-
|
|
147
|
-
This function reads a value from the cache.
|
|
148
|
-
_It is intended to be called from a worker process_.
|
|
149
|
-
|
|
150
|
-
**Arguments**:
|
|
151
|
-
|
|
152
|
-
- **key** {String} (required): Key used to lookup the entry
|
|
153
|
-
- **callback** {Function} (required): Function to be called on read completion. Callback arguments:
|
|
154
|
-
- _err_ {Error}: Optional error
|
|
155
|
-
- _value_ {Mixed}: Contents of the cached entry. If the value is not found or is expired, it will be undefined.
|
|
156
|
-
|
|
157
|
-
**Example**:
|
|
158
|
-
```javascript
|
|
159
|
-
memored.read('key1', function(err, value) {
|
|
160
|
-
console.log('Key1 value:', value);
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
memored.read('key1', function(err, value, expirationTime) {
|
|
164
|
-
console.log('Key1 value:', value);
|
|
165
|
-
console.log('Key1 expiration time:', new Date(expirationTime));
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
memored.read('unknownKey', function(err, value) {
|
|
169
|
-
console.log('No data read?', value === undefined);
|
|
170
|
-
});
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
### remove(key, callback)
|
|
174
|
-
|
|
175
|
-
This function removes an entry from the cache.
|
|
176
|
-
_It is intended to be called from a worker process_.
|
|
177
|
-
|
|
178
|
-
**Arguments**:
|
|
179
|
-
|
|
180
|
-
- **key** {String} (required): Key used to lookup the entry
|
|
181
|
-
- **callback** {Function} (optional): Function to be called on read completion.
|
|
182
|
-
|
|
183
|
-
**Example**:
|
|
184
|
-
```javascript
|
|
185
|
-
memored.remove('key1', function() {
|
|
186
|
-
console.log('Key removed from the cache.');
|
|
187
|
-
});
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
### clean(callback)
|
|
191
|
-
|
|
192
|
-
This function removes all the entries from the cache.
|
|
193
|
-
_It is intended to be called from a worker process_.
|
|
194
|
-
|
|
195
|
-
**Arguments**:
|
|
196
|
-
|
|
197
|
-
- **callback** {Function} (optional): Function to be called on read completion.
|
|
198
|
-
|
|
199
|
-
**Example**:
|
|
200
|
-
```javascript
|
|
201
|
-
memored.clean(function() {
|
|
202
|
-
console.log('All cache entries have been deleted.');
|
|
203
|
-
});
|
|
204
|
-
```
|
|
205
|
-
|
|
206
|
-
### size(callback)
|
|
207
|
-
|
|
208
|
-
This function returns the number of entries in the cache.
|
|
209
|
-
|
|
210
|
-
**Arguments**:
|
|
211
|
-
|
|
212
|
-
- **callback** {Function} (required): Function to be called on size calculation is complete. Callback arguments:
|
|
213
|
-
- _err_ {Error}: Optional error
|
|
214
|
-
- _size_ {Number}: The number of entries in the cache.
|
|
215
|
-
|
|
216
|
-
**Example**:
|
|
217
|
-
|
|
218
|
-
```javascript
|
|
219
|
-
memored.size(function(err, size) {
|
|
220
|
-
console.log('Cache size:', size);
|
|
221
|
-
});
|
|
222
|
-
```
|
|
223
|
-
|
|
224
|
-
### version
|
|
225
|
-
|
|
226
|
-
This is an attribute wich provides module's version number
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
# Final note
|
|
230
|
-
All the callbacks first parameter is an optional error object. Actually, this param will never be an error because there is no expected error in the internal code. There's no function call that can possible throw an expected error that this module would deal with.
|
|
231
|
-
The existence of this param is to follow the *convention* about libraries callbacks in nodejs. As everybody expects this first callback parameter to be an optional one, I decided to include it.
|
|
232
|
-
|
|
233
|
-
- [Nodeguide](http://nodeguide.com/style.html#callbacks)
|
|
234
|
-
- [Nodejitsu](http://docs.nodejitsu.com/articles/errors/what-are-the-error-conventions)
|
|
235
|
-
- [GoSquared](https://engineering.gosquared.com/node-js-error-handling-callbacks-vs-promises)
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
## License
|
|
239
|
-
Copyright (c) 2014 PaquitoSoft
|
|
240
|
-
Licensed under the MIT license.
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
var cluster = require('cluster'),
|
|
2
|
-
memored = require('../index');
|
|
3
|
-
|
|
4
|
-
if (cluster.isMaster) {
|
|
5
|
-
cluster.fork();
|
|
6
|
-
} else {
|
|
7
|
-
var han = {
|
|
8
|
-
firstname: 'Han',
|
|
9
|
-
lastname: 'Solo'
|
|
10
|
-
},
|
|
11
|
-
luke = {
|
|
12
|
-
firstname: 'Luke',
|
|
13
|
-
lastname: 'Skywalker'
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
// Store and read
|
|
17
|
-
memored.store('character1', han, function() {
|
|
18
|
-
console.log('Value stored!');
|
|
19
|
-
|
|
20
|
-
memored.read('character1', function(err, value) {
|
|
21
|
-
console.log('Read value:', value);
|
|
22
|
-
});
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
// You can also set a ttl (milliseconds)
|
|
26
|
-
memored.store('character2', luke, 1000, function(err, expirationTime) {
|
|
27
|
-
console.log('Value stored until:', new Date(expirationTime));
|
|
28
|
-
|
|
29
|
-
setTimeout(function() {
|
|
30
|
-
memored.read('character2', function(err, value) {
|
|
31
|
-
console.log('Value is gone?', value === undefined);
|
|
32
|
-
|
|
33
|
-
process.exit();
|
|
34
|
-
});
|
|
35
|
-
}, 1050);
|
|
36
|
-
});
|
|
37
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
var cluster = require('cluster'),
|
|
2
|
-
async = require('async'),
|
|
3
|
-
memored = require('../index');
|
|
4
|
-
|
|
5
|
-
if (cluster.isMaster) {
|
|
6
|
-
|
|
7
|
-
cluster.fork();
|
|
8
|
-
memored.setup({ purgeInterval: 500});
|
|
9
|
-
|
|
10
|
-
} else {
|
|
11
|
-
|
|
12
|
-
async.series({
|
|
13
|
-
storeValue: function(next) {
|
|
14
|
-
memored.store('key1', 'My simple string value', 100, next);
|
|
15
|
-
},
|
|
16
|
-
readCacheSize: function(next) {
|
|
17
|
-
memored.size(function(err, size) {
|
|
18
|
-
console.log('Current size is 1?', size === 1);
|
|
19
|
-
next();
|
|
20
|
-
});
|
|
21
|
-
},
|
|
22
|
-
wait: function(next) {
|
|
23
|
-
setTimeout(next, 600);
|
|
24
|
-
},
|
|
25
|
-
readCacheSizeAgain: function(next) {
|
|
26
|
-
memored.size(function(err, size) {
|
|
27
|
-
console.log('Current size is 0?', size === 0);
|
|
28
|
-
next();
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
}, process.exit);
|
|
32
|
-
}
|
package/temp/memored/gulpfile.js
DELETED