New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@midwayjs/cache-manager

Package Overview
Dependencies
Maintainers
0
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@midwayjs/cache-manager - npm Package Compare versions

Comparing version 3.19.2 to 4.0.0-alpha.1

4

dist/base/cacheManager.js

@@ -49,3 +49,3 @@ "use strict";

}
else if (args === null || args === void 0 ? void 0 : args.refreshThreshold) {
else if (args?.refreshThreshold) {
const cacheTTL = typeof ttl === 'function' ? ttl(value) : ttl;

@@ -77,3 +77,3 @@ const remainingTtl = await store.ttl(key);

}
else if (args === null || args === void 0 ? void 0 : args.refreshThreshold) {
else if (args?.refreshThreshold) {
const cacheTTL = typeof ttl === 'function' ? ttl(value) : ttl;

@@ -80,0 +80,0 @@ const remainingTtl = await store.ttl(key);

@@ -53,4 +53,3 @@ "use strict";

function getCallbacksByKey(key) {
var _a;
return (_a = callbacks.get(key)) !== null && _a !== void 0 ? _a : [];
return callbacks.get(key) ?? [];
}

@@ -57,0 +56,0 @@ function enqueue(key) {

@@ -16,10 +16,9 @@ "use strict";

function memoryStore(args) {
var _a;
const shouldCloneBeforeSet = (args === null || args === void 0 ? void 0 : args.shouldCloneBeforeSet) !== false; // clone by default
const isCacheable = (_a = args === null || args === void 0 ? void 0 : args.isCacheable) !== null && _a !== void 0 ? _a : (val => val !== undefined);
const shouldCloneBeforeSet = args?.shouldCloneBeforeSet !== false; // clone by default
const isCacheable = args?.isCacheable ?? (val => val !== undefined);
const lruOpts = {
ttlAutopurge: true,
...args,
max: (args === null || args === void 0 ? void 0 : args.max) || 500,
ttl: (args === null || args === void 0 ? void 0 : args.ttl) !== undefined ? args.ttl : 0,
max: args?.max || 500,
ttl: args?.ttl !== undefined ? args.ttl : 0,
};

@@ -26,0 +25,0 @@ const lruCache = new LRUCache(lruOpts);

@@ -17,3 +17,7 @@ "use strict";

function getClassMethodDefaultCacheKey(target, methodName) {
return target.name + '-' + (0, core_1.getProviderUUId)(target) + '-' + methodName;
return (target.name +
'-' +
core_1.DecoratorManager.getProviderUUId(target) +
'-' +
methodName);
}

@@ -52,2 +56,3 @@ exports.getClassMethodDefaultCacheKey = getClassMethodDefaultCacheKey;

};
exports.CacheConfiguration = CacheConfiguration;
__decorate([

@@ -57,3 +62,3 @@ (0, core_1.Inject)(),

], CacheConfiguration.prototype, "decoratorService", void 0);
CacheConfiguration = __decorate([
exports.CacheConfiguration = CacheConfiguration = __decorate([
(0, core_1.Configuration)({

@@ -70,3 +75,2 @@ namespace: 'cacheManager',

], CacheConfiguration);
exports.CacheConfiguration = CacheConfiguration;
//# sourceMappingURL=configuration.js.map

@@ -11,3 +11,3 @@ "use strict";

}
return (0, core_1.createCustomMethodDecorator)(exports.CACHE_DECORATOR_KEY, {
return core_1.DecoratorManager.createCustomMethodDecorator(exports.CACHE_DECORATOR_KEY, {
cacheInstanceName,

@@ -14,0 +14,0 @@ cacheKey: cacheKeyOrTTL,

@@ -73,2 +73,3 @@ "use strict";

};
exports.CachingFactory = CachingFactory;
__decorate([

@@ -88,7 +89,6 @@ (0, core_1.Config)('cacheManager'),

], CachingFactory.prototype, "init", null);
CachingFactory = __decorate([
exports.CachingFactory = CachingFactory = __decorate([
(0, core_1.Provide)(),
(0, core_1.Scope)(core_1.ScopeEnum.Singleton)
], CachingFactory);
exports.CachingFactory = CachingFactory;
//# sourceMappingURL=factory.js.map

@@ -16,3 +16,3 @@ "use strict";

function createStore(redisCache, options) {
const isCacheable = (options === null || options === void 0 ? void 0 : options.isCacheable) || (value => value !== undefined && value !== null);
const isCacheable = options?.isCacheable || (value => value !== undefined && value !== null);
const keys = (pattern) => redisCache.keys(pattern);

@@ -36,3 +36,3 @@ return {

throw new core_1.MidwayCommonError(`"${value}" is not a cacheable value`);
const t = ttl === undefined ? options === null || options === void 0 ? void 0 : options.ttl : ttl;
const t = ttl === undefined ? options?.ttl : ttl;
if (t !== undefined && t !== 0)

@@ -44,3 +44,3 @@ await redisCache.set(key, getVal(value), 'PX', t);

async mset(args, ttl) {
const t = ttl === undefined ? options === null || options === void 0 ? void 0 : options.ttl : ttl;
const t = ttl === undefined ? options?.ttl : ttl;
if (t !== undefined && t !== 0) {

@@ -70,3 +70,3 @@ const multi = redisCache.multi();

}
catch (_a) {
catch {
return x;

@@ -73,0 +73,0 @@ }

{
"name": "@midwayjs/cache-manager",
"version": "3.19.2",
"version": "4.0.0-alpha.1",
"description": "midway cache manager",

@@ -9,4 +9,4 @@ "main": "dist/index.js",

"build": "tsc",
"test": "node --require=ts-node/register ../../node_modules/.bin/jest --runInBand",
"cov": "node --require=ts-node/register ../../node_modules/.bin/jest --runInBand --coverage --forceExit"
"test": "node -r ts-node/register ../../node_modules/jest/bin/jest.js --runInBand",
"cov": "node -r ts-node/register ../../node_modules/jest/bin/jest.js --runInBand --coverage --forceExit"
},

@@ -32,5 +32,5 @@ "author": "",

"devDependencies": {
"@midwayjs/core": "^3.19.0",
"@midwayjs/mock": "^3.19.2",
"@midwayjs/redis": "^3.19.2",
"@midwayjs/core": "^4.0.0-alpha.1",
"@midwayjs/mock": "^4.0.0-alpha.1",
"@midwayjs/redis": "^4.0.0-alpha.1",
"cache-manager": "6.0.0",

@@ -43,3 +43,3 @@ "cache-manager-ioredis-yet": "2.1.2"

},
"gitHead": "57fd034be94897fb819b0d9ef776de0b9923ab0f"
"gitHead": "14bb4da91805a1cf52f190c0d37a74b395dd6372"
}
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