| 29 | * }} SqliteStoreValue |
| 30 | */ |
| 31 | module.exports = class SqliteCacheStore { |
| 32 | #maxEntrySize = MAX_ENTRY_SIZE |
| 33 | #maxCount = Infinity |
| 34 | |
| 35 | /** |
| 36 | * @type {import('node:sqlite').DatabaseSync} |
| 37 | */ |
| 38 | #db |
| 39 | |
| 40 | /** |
| 41 | * @type {import('node:sqlite').StatementSync} |
| 42 | */ |
| 43 | #getValuesQuery |
| 44 | |
| 45 | /** |
| 46 | * @type {import('node:sqlite').StatementSync} |
| 47 | */ |
| 48 | #updateValueQuery |
| 49 | |
| 50 | /** |
| 51 | * @type {import('node:sqlite').StatementSync} |
| 52 | */ |
| 53 | #insertValueQuery |
| 54 | |
| 55 | /** |
| 56 | * @type {import('node:sqlite').StatementSync} |
| 57 | */ |
| 58 | #deleteExpiredValuesQuery |
| 59 | |
| 60 | /** |
| 61 | * @type {import('node:sqlite').StatementSync} |
| 62 | */ |
| 63 | #deleteByUrlQuery |
| 64 | |
| 65 | /** |
| 66 | * @type {import('node:sqlite').StatementSync} |
| 67 | */ |
| 68 | #countEntriesQuery |
| 69 | |
| 70 | /** |
| 71 | * @type {import('node:sqlite').StatementSync | null} |
| 72 | */ |
| 73 | #deleteOldValuesQuery |
| 74 | |
| 75 | /** |
| 76 | * @param {import('../../types/cache-interceptor.d.ts').default.SqliteCacheStoreOpts | undefined} opts |
| 77 | */ |
| 78 | constructor (opts) { |
| 79 | if (opts) { |
| 80 | if (typeof opts !== 'object') { |
| 81 | throw new TypeError('SqliteCacheStore options must be an object') |
| 82 | } |
| 83 | |
| 84 | if (opts.maxEntrySize !== undefined) { |
| 85 | if ( |
| 86 | typeof opts.maxEntrySize !== 'number' || |
| 87 | !Number.isInteger(opts.maxEntrySize) || |
| 88 | opts.maxEntrySize < 0 |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…