diff --git a/lib/cache/memory-cache-store.js b/lib/cache/memory-cache-store.js index 6a00568ca22..17ec428cb6d 100644 --- a/lib/cache/memory-cache-store.js +++ b/lib/cache/memory-cache-store.js @@ -13,7 +13,7 @@ const { Writable } = require('node:stream') * }} MemoryStoreValue */ class MemoryCacheStore { - #maxEntries = Infinity + #maxCount = Infinity #maxEntrySize = Infinity @@ -33,15 +33,15 @@ class MemoryCacheStore { throw new TypeError('MemoryCacheStore options must be an object') } - if (opts.maxEntries !== undefined) { + if (opts.maxCount !== undefined) { if ( - typeof opts.maxEntries !== 'number' || - !Number.isInteger(opts.maxEntries) || - opts.maxEntries < 0 + typeof opts.maxCount !== 'number' || + !Number.isInteger(opts.maxCount) || + opts.maxCount < 0 ) { - throw new TypeError('MemoryCacheStore options.maxEntries must be a non-negative integer') + throw new TypeError('MemoryCacheStore options.maxCount must be a non-negative integer') } - this.#maxEntries = opts.maxEntries + this.#maxCount = opts.maxCount } if (opts.maxEntrySize !== undefined) { @@ -58,7 +58,7 @@ class MemoryCacheStore { } get isFull () { - return this.#entryCount >= this.#maxEntries + return this.#entryCount >= this.#maxCount } /** diff --git a/types/cache-interceptor.d.ts b/types/cache-interceptor.d.ts index 1c30b42d359..015c2025eba 100644 --- a/types/cache-interceptor.d.ts +++ b/types/cache-interceptor.d.ts @@ -77,11 +77,13 @@ declare namespace CacheHandler { /** * @default Infinity */ - maxEntries?: number + maxCount?: number + /** * @default Infinity */ maxEntrySize?: number + errorCallback?: (err: Error) => void }