fix(deps): update dependency cacheable to v2 #336

Merged
renovate[bot] merged 3 commits from renovate/cacheable-2.x into main 2025-09-10 10:11:52 +00:00
4 changed files with 50 additions and 7 deletions

51
package-lock.json generated
View file

@ -13,7 +13,7 @@
"@types/jsdom": "^21.1.7",
"async-mutex": "^0.5.0",
"bytes": "^3.1.2",
"cacheable": "^1.10.4",
"cacheable": "^2.0.0",
"cheerio": "^1.0.0",
"express": "^5.1.0",
"fetch-socks": "^1.3.2",
@ -568,6 +568,34 @@
"dev": true,
"license": "MIT"
},
"node_modules/@cacheable/memoize": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/@cacheable/memoize/-/memoize-2.0.0.tgz",
"integrity": "sha512-Q6PjhmFuLOKLFSLrs/2NaGvryuiTsUJON+rJlUxkzXQowja7hmqD9Y8iFU9UgocMoUbW31bMcpyGZWj5A8Q+1Q==",
"license": "MIT",
"dependencies": {
"@cacheable/utils": "^2.0.0"
}
},
"node_modules/@cacheable/memory": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/@cacheable/memory/-/memory-2.0.0.tgz",
"integrity": "sha512-zVRFSZvkRYmDPxn7H83c7GqzJeXCb8fEuz0q/McG9VtiF/somlQwyRFstBSyKFJyq/IvUGfir1uSKg/WkWiTTA==",
"license": "MIT",
"dependencies": {
"@cacheable/memoize": "^2.0.0",
"@cacheable/utils": "^2.0.0",
"@keyv/bigmap": "^1.0.0",
"hookified": "^1.12.0",
"keyv": "^5.5.0"
}
},
"node_modules/@cacheable/utils": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/@cacheable/utils/-/utils-2.0.0.tgz",
"integrity": "sha512-Y+ZxdxSo2ErcROjNCdButjobQDuu4mpx875uhItK6ZqW3XmDikG+YIjh30ELfOZnVFjxfpvgjz57HbYJ0m1ApQ==",
"license": "MIT"
},
"node_modules/@colors/colors": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/@colors/colors/-/colors-1.6.0.tgz",
@ -1413,6 +1441,18 @@
"@jridgewell/sourcemap-codec": "^1.4.14"
}
},
"node_modules/@keyv/bigmap": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/@keyv/bigmap/-/bigmap-1.0.0.tgz",
"integrity": "sha512-N2UsRSXlWwbvYKdFVS7sKqj6oXGegELh+zr9VripWDc8grsq8KBNp8JHI+9AQuUEFiM1S7+tm6lLp/lmbBCqCw==",
"license": "MIT",
"dependencies": {
"hookified": "^1.10.0"
},
"engines": {
"node": ">= 20"
}
},
"node_modules/@keyv/serialize": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@keyv/serialize/-/serialize-1.1.0.tgz",
@ -3314,11 +3354,14 @@
"optional": true
},
"node_modules/cacheable": {
"version": "1.10.4",
"resolved": "https://registry.npmjs.org/cacheable/-/cacheable-1.10.4.tgz",
"integrity": "sha512-Gd7ccIUkZ9TE2odLQVS+PDjIvQCdJKUlLdJRVvZu0aipj07Qfx+XIej7hhDrKGGoIxV5m5fT/kOJNJPQhQneRg==",
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/cacheable/-/cacheable-2.0.0.tgz",
"integrity": "sha512-b8AHJNiDmWu7Eg83rRDhu6mbG2qRG+84tAFq1wS+vgHEp6x9qYeyPz5lszfefftbmXpvjzCqcvZiK4fOO1iNMQ==",
"license": "MIT",
"dependencies": {
"@cacheable/memoize": "^2.0.0",
"@cacheable/memory": "^2.0.0",
"@cacheable/utils": "^2.0.0",
"hookified": "^1.11.0",
"keyv": "^5.5.0"
}

View file

@ -35,7 +35,7 @@
"@types/jsdom": "^21.1.7",
"async-mutex": "^0.5.0",
"bytes": "^3.1.2",
"cacheable": "^1.10.4",
"cacheable": "^2.0.0",
"cheerio": "^1.0.0",
"express": "^5.1.0",
"fetch-socks": "^1.3.2",

View file

@ -39,7 +39,7 @@ export class ExtractorRegistry {
? `${extractor.id}_${normalizedUrl}_${ctx.config.mediaFlowProxyUrl}`
: `${extractor.id}_${normalizedUrl}`;
const storedDataRaw = await this.urlResultCache.get<UrlResult[]>(cacheKey, { raw: true });
const storedDataRaw = await this.urlResultCache.getRaw<UrlResult[]>(cacheKey);
const expires = storedDataRaw?.expires;
if (storedDataRaw && expires) {
// Ignore the cache randomly after at least 2/3 of the TTL passed to start refreshing results slowly

View file

@ -262,7 +262,7 @@ export class Fetcher {
protected async fetchWithTimeout(ctx: Context, url: URL, init?: CustomRequestInit, tryCount = 0): Promise<Response> {
this.logger.info(`Fetch ${init?.method ?? 'GET'} ${url}`, ctx);
const isRateLimitedRaw = await this.rateLimitedCache.get<true>(url.host, { raw: true });
const isRateLimitedRaw = await this.rateLimitedCache.getRaw<true>(url.host);
/* istanbul ignore if */
if (isRateLimitedRaw && isRateLimitedRaw.value && isRateLimitedRaw.expires) {
const ttl = isRateLimitedRaw.expires - Date.now();