@nxtedition/nxt-undici 6.2.23 → 6.2.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/sqlite-cache-store.js +2 -10
- package/package.json +1 -1
|
@@ -50,11 +50,6 @@ export class SqliteCacheStore {
|
|
|
50
50
|
*/
|
|
51
51
|
#deleteByUrlQuery
|
|
52
52
|
|
|
53
|
-
/**
|
|
54
|
-
* @type {NodeJS.Timeout}
|
|
55
|
-
*/
|
|
56
|
-
#pruneInterval
|
|
57
|
-
|
|
58
53
|
/**
|
|
59
54
|
* @param {import('undici-types/cache-interceptor.d.ts').default.SqliteCacheStoreOpts & { maxEntryCount?: number} | undefined} opts
|
|
60
55
|
*/
|
|
@@ -134,14 +129,9 @@ export class SqliteCacheStore {
|
|
|
134
129
|
this.#deleteExpiredValuesQuery = this.#db.prepare(
|
|
135
130
|
`DELETE FROM cacheInterceptorV${VERSION} WHERE deleteAt <= ?`,
|
|
136
131
|
)
|
|
137
|
-
|
|
138
|
-
this.#pruneInterval = setInterval(() => {
|
|
139
|
-
this.#deleteExpiredValuesQuery.run(Date.now())
|
|
140
|
-
}, 60e3).unref()
|
|
141
132
|
}
|
|
142
133
|
|
|
143
134
|
close() {
|
|
144
|
-
clearInterval(this.#pruneInterval)
|
|
145
135
|
this.#db.close()
|
|
146
136
|
}
|
|
147
137
|
|
|
@@ -170,6 +160,8 @@ export class SqliteCacheStore {
|
|
|
170
160
|
assert(Number.isFinite(value.end))
|
|
171
161
|
assert(!body || body?.byteLength === value.end - value.start)
|
|
172
162
|
|
|
163
|
+
this.#deleteExpiredValuesQuery.run(Date.now())
|
|
164
|
+
|
|
173
165
|
this.#insertValueQuery.run(
|
|
174
166
|
makeValueUrl(key),
|
|
175
167
|
key.method,
|