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 CHANGED
@@ -1,3 +1,6 @@
1
+ - 3.5.0 2021-11-11
2
+ - Added dump() and load() methods to memory store (#171). - @jeoy
3
+
1
4
  - 3.4.4 2021-06-11
2
5
  - vulnerability fix in package-lock.json.
3
6
 
@@ -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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cache-manager",
3
- "version": "3.4.4",
3
+ "version": "3.5.0",
4
4
  "description": "Cache module for Node.js",
5
5
  "main": "index.js",
6
6
  "files": [