cache-manager 3.4.2 → 3.6.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,15 @@
1
+ - 3.6.0 2021-11-12
2
+ - Added keyCount() method to memory store (#173). - @css-master
3
+
4
+ - 3.5.0 2021-11-11
5
+ - Added dump() and load() methods to memory store (#171). - @jeoy
6
+
7
+ - 3.4.4 2021-06-11
8
+ - vulnerability fix in package-lock.json.
9
+
10
+ - 3.4.3 2021-03-30
11
+ - Bump y18n in package-lock.json (vulnerability fix).
12
+
1
13
  - 3.4.2 2021-03-29
2
14
  - Catch uncaught exception to pass it to callback (#154) - @lchenay
3
15
 
package/README.md CHANGED
@@ -39,8 +39,6 @@ See the [Express.js cache-manager example app](https://github.com/BryanDonovan/n
39
39
 
40
40
  * [node-cache-manager-mongoose](https://github.com/disjunction/node-cache-manager-mongoose)
41
41
 
42
- * [node-cache-manager-fs](https://github.com/hotelde/node-cache-manager-fs)
43
-
44
42
  * [node-cache-manager-fs-binary](https://github.com/sheershoff/node-cache-manager-fs-binary)
45
43
 
46
44
  * [node-cache-manager-fs-hash](https://github.com/rolandstarke/node-cache-manager-fs-hash)
@@ -217,7 +215,7 @@ memoryCache.wrap(key1, key2, function (cb) {
217
215
  #### Example setting/getting several keys with mset() and mget()
218
216
 
219
217
  ```js
220
- memoryCache.mset('foo', 'bar', 'foo2', 'bar2' {ttl: ttl}, function(err) {
218
+ memoryCache.mset('foo', 'bar', 'foo2', 'bar2', {ttl: ttl}, function(err) {
221
219
  if (err) { throw err; }
222
220
 
223
221
  memoryCache.mget('foo', 'foo2', function(err, result) {
@@ -186,6 +186,47 @@ var memoryStore = function(args) {
186
186
  }
187
187
  };
188
188
 
189
+ /**
190
+ * This method is not available in the caching modules.
191
+ */
192
+ self.keyCount = function() {
193
+ return lruCache.length;
194
+ };
195
+
196
+ /**
197
+ * This method is not available in the caching modules.
198
+ */
199
+ self.dump = function() {
200
+ var args = Array.prototype.slice.apply(arguments);
201
+ var cb;
202
+
203
+ if (typeof args[args.length - 1] === 'function') {
204
+ cb = args.pop();
205
+ }
206
+ var value = lruCache.dump();
207
+
208
+ if (cb) {
209
+ process.nextTick(cb.bind(null, null, value));
210
+ } else if (self.usePromises) {
211
+ return Promise.resolve(value);
212
+ } else {
213
+ return value;
214
+ }
215
+ };
216
+
217
+ /**
218
+ * This method is not available in the caching modules.
219
+ */
220
+ self.load = function(cacheEntries, cb) {
221
+ lruCache.load(cacheEntries);
222
+
223
+ if (typeof cb === 'function') {
224
+ process.nextTick(cb.bind(null, null));
225
+ } else if (self.usePromises) {
226
+ return Promise.resolve();
227
+ }
228
+ };
229
+
189
230
  return self;
190
231
  };
191
232
 
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "cache-manager",
3
- "version": "3.4.2",
3
+ "version": "3.6.0",
4
4
  "description": "Cache module for Node.js",
5
5
  "main": "index.js",
6
6
  "files": [
7
- "index.js",
8
- "/examples",
9
- "/lib"
7
+ "index.js",
8
+ "/examples",
9
+ "/lib"
10
10
  ],
11
11
  "scripts": {
12
12
  "test": "make"
@@ -39,4 +39,4 @@
39
39
  "optimist": "0.6.1",
40
40
  "sinon": "9.0.3"
41
41
  }
42
- }
42
+ }