@type-cacheable/lru-cache-adapter
Advanced tools
Comparing version 8.0.5 to 9.0.1
@@ -31,7 +31,13 @@ "use strict"; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return Promise.resolve(this.lruClient.set(cacheKey, value, ttl)); | ||
// the lru-cache takes ttl in ms instead of seconds, so convert seconds to ms | ||
return Promise.resolve(this.lruClient.set(cacheKey, value, ttl ? ttl * 1000 : undefined)); | ||
}); | ||
} | ||
getClientTTL() { | ||
return this.lruClient.maxAge; | ||
try { | ||
return this.lruClient.maxAge / 1000; | ||
} | ||
catch (_a) { | ||
return 0; | ||
} | ||
} | ||
@@ -65,3 +71,5 @@ del(keyOrKeys) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const finalDeleteKeys = Array.isArray(hashKeyOrKeys) ? hashKeyOrKeys : [hashKeyOrKeys]; | ||
const finalDeleteKeys = Array.isArray(hashKeyOrKeys) | ||
? hashKeyOrKeys | ||
: [hashKeyOrKeys]; | ||
const deletePromises = finalDeleteKeys.map((key) => this.keys(key).then(this.del)); | ||
@@ -68,0 +76,0 @@ yield Promise.all(deletePromises); |
{ | ||
"name": "@type-cacheable/lru-cache-adapter", | ||
"version": "8.0.5", | ||
"version": "9.0.1", | ||
"description": "Adapter for using lru-cache with type-cacheable", | ||
@@ -38,2 +38,3 @@ "main": "dist/index.js", | ||
"devDependencies": { | ||
"@type-cacheable/core": "^9.0.1", | ||
"@types/jest": "^26.0.0", | ||
@@ -45,8 +46,6 @@ "@types/lru-cache": "^5.1.0", | ||
"peerDependencies": { | ||
"@type-cacheable/core": "^8.0.5", | ||
"lru-cache": "^6.0.0" | ||
}, | ||
"dependencies": { | ||
"@type-cacheable/core": "^8.0.5" | ||
}, | ||
"gitHead": "7ac5ff2c0b600938d7f7ae879b16ee36b169cf7e" | ||
"gitHead": "b667a76bdef5ae84d5d4cac1fef6c9721e00c3cb" | ||
} |
@@ -31,2 +31,2 @@ # @type-cacheable/lru-cache-adapter | ||
Then you can rely on the `@Cacheable`, `@CacheUpdate`, and `@CacheClear` decorators from `@type-cacheable/core`. [See core documentation](https://github.com/joshuaslate/type-cacheable/tree/master/packages/core) | ||
Then you can rely on the `@Cacheable`, `@CacheUpdate`, and `@CacheClear` decorators from `@type-cacheable/core`. [See core documentation](https://github.com/joshuaslate/type-cacheable/tree/main/packages/core) |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9740
101
5
- Removed@type-cacheable/core@^8.0.5