Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cache-manager

Package Overview
Dependencies
Maintainers
2
Versions
110
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cache-manager - npm Package Compare versions

Comparing version 5.1.1 to 5.1.2

46

dist/multi-caching.js

@@ -121,19 +121,49 @@ "use strict";

}); },
wrap: function (key, fn) {
wrap: function (key, fn, ttl) {
return __awaiter(this, void 0, void 0, function () {
var value, result;
var value, i, e_3, result, j;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, get(key)];
case 0:
i = 0;
_a.label = 1;
case 1:
if (!(i < caches.length)) return [3 /*break*/, 6];
_a.label = 2;
case 2:
_a.trys.push([2, 4, , 5]);
return [4 /*yield*/, caches[i].get(key)];
case 3:
value = _a.sent();
if (!(value === undefined)) return [3 /*break*/, 4];
if (value !== undefined)
return [3 /*break*/, 6];
return [3 /*break*/, 5];
case 4:
e_3 = _a.sent();
return [3 /*break*/, 5];
case 5:
i++;
return [3 /*break*/, 1];
case 6:
if (!(value === undefined)) return [3 /*break*/, 9];
return [4 /*yield*/, fn()];
case 2:
case 7:
result = _a.sent();
return [4 /*yield*/, set(key, result)];
case 3:
return [4 /*yield*/, set(key, result, ttl)];
case 8:
_a.sent();
return [2 /*return*/, result];
case 4: return [2 /*return*/, value];
case 9:
j = 0;
_a.label = 10;
case 10:
if (!(j < i)) return [3 /*break*/, 13];
return [4 /*yield*/, caches[j].set(key, value, ttl)];
case 11:
_a.sent();
_a.label = 12;
case 12:
j++;
return [3 /*break*/, 10];
case 13: return [2 /*return*/, value];
}

@@ -140,0 +170,0 @@ });

18

package.json
{
"name": "cache-manager",
"version": "5.1.1",
"version": "5.1.2",
"description": "Cache module for Node.js",

@@ -36,13 +36,13 @@ "main": "dist/index.js",

"devDependencies": {
"@commitlint/cli": "17.1.2",
"@commitlint/config-conventional": "17.1.0",
"@commitlint/cli": "17.2.0",
"@commitlint/config-conventional": "17.2.0",
"@faker-js/faker": "7.6.0",
"@release-it/conventional-changelog": "5.1.1",
"@types/lodash.clonedeep": "4.5.7",
"@types/node": "18.8.3",
"@typescript-eslint/eslint-plugin": "5.40.1",
"@typescript-eslint/parser": "5.40.1",
"@vitest/coverage-c8": "0.24.3",
"@types/node": "18.11.9",
"@typescript-eslint/eslint-plugin": "5.42.0",
"@typescript-eslint/parser": "5.42.0",
"@vitest/coverage-c8": "0.24.5",
"dotenv-cli": "6.0.0",
"eslint": "8.25.0",
"eslint": "8.26.0",
"eslint-config-prettier": "8.5.0",

@@ -55,3 +55,3 @@ "eslint-plugin-prettier": "4.2.1",

"typescript": "4.8.4",
"vitest": "0.24.3"
"vitest": "0.24.5"
},

@@ -58,0 +58,0 @@ "lint-staged": {

@@ -52,3 +52,3 @@ # node-cache-manager [![npm version](https://badge.fury.io/js/cache-manager.svg)](https://www.npmjs.com/package/cache-manager) [![codecov](https://codecov.io/gh/node-cache-manager/node-cache-manager/branch/master/graph/badge.svg?token=ZV3G5IFigq)](https://codecov.io/gh/node-cache-manager/node-cache-manager)

See unit tests in `test/caching.ts` for more information.
See unit tests in [`test/caching.test.ts`](./test/caching.test.ts) for more information.

@@ -77,6 +77,8 @@ #### Example setting/getting several keys with mset() and mget()

You can use your own custom store by creating one with the same API as the
built-in memory stores (such as a redis or memcached store). To use your own store just pass
in an instance of it. [example](https://github.com/node-cache-manager/node-cache-manager-redis-yet)
You can use your own custom store by creating one with the same API as the built-in memory stores.
- [Example Custom Store lru-cache](./src/stores/memory.ts)
- [Example Custom Store redis](https://github.com/node-cache-manager/node-cache-manager-redis-yet)
- [Example Custom Store ioredis](https://github.com/node-cache-manager/node-cache-manager-ioredis-yet)
### Multi-Store

@@ -103,2 +105,4 @@

See unit tests in [`test/multi-caching.test.ts`](./test/multi-caching.test.ts) for more information.
## Store Engines

@@ -118,3 +122,3 @@

- [node-cache-manager-ioredis](https://github.com/dabroek/node-cache-manager-ioredis) (uses [ioredis](https://github.com/luin/ioredis))
- [node-cache-manager-ioredis](https://github.com/Tirke/node-cache-manager-ioredis) (uses [ioredis](https://github.com/luin/ioredis))

@@ -121,0 +125,0 @@ - [node-cache-manager-mongodb](https://github.com/v4l3r10/node-cache-manager-mongodb)

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc