cache-manager 3.4.4 → 3.5.0
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/History.md +3 -0
- package/lib/stores/memory.js +34 -0
- package/package.json +1 -1
package/History.md
CHANGED
package/lib/stores/memory.js
CHANGED
|
@@ -186,6 +186,40 @@ var memoryStore = function(args) {
|
|
|
186
186
|
}
|
|
187
187
|
};
|
|
188
188
|
|
|
189
|
+
/**
|
|
190
|
+
* This method is not available in the caching modules.
|
|
191
|
+
*/
|
|
192
|
+
self.dump = function() {
|
|
193
|
+
var args = Array.prototype.slice.apply(arguments);
|
|
194
|
+
var cb;
|
|
195
|
+
|
|
196
|
+
if (typeof args[args.length - 1] === 'function') {
|
|
197
|
+
cb = args.pop();
|
|
198
|
+
}
|
|
199
|
+
var value = lruCache.dump();
|
|
200
|
+
|
|
201
|
+
if (cb) {
|
|
202
|
+
process.nextTick(cb.bind(null, null, value));
|
|
203
|
+
} else if (self.usePromises) {
|
|
204
|
+
return Promise.resolve(value);
|
|
205
|
+
} else {
|
|
206
|
+
return value;
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* This method is not available in the caching modules.
|
|
212
|
+
*/
|
|
213
|
+
self.load = function(cacheEntries, cb) {
|
|
214
|
+
lruCache.load(cacheEntries);
|
|
215
|
+
|
|
216
|
+
if (typeof cb === 'function') {
|
|
217
|
+
process.nextTick(cb.bind(null, null));
|
|
218
|
+
} else if (self.usePromises) {
|
|
219
|
+
return Promise.resolve();
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
|
|
189
223
|
return self;
|
|
190
224
|
};
|
|
191
225
|
|