File tree 1 file changed +4
-11
lines changed
1 file changed +4
-11
lines changed Original file line number Diff line number Diff line change @@ -265,8 +265,6 @@ class SqliteCacheStore {
265
265
callback ( )
266
266
} ,
267
267
final ( callback ) {
268
- store . prune ( )
269
-
270
268
const existingValue = store . #findValue( key , true )
271
269
if ( existingValue ) {
272
270
// Updating an existing response, let's overwrite it
@@ -283,6 +281,7 @@ class SqliteCacheStore {
283
281
existingValue . id
284
282
)
285
283
} else {
284
+ store . #prune( )
286
285
// New response, let's insert it
287
286
store . #insertValueQuery. run (
288
287
url ,
@@ -316,14 +315,8 @@ class SqliteCacheStore {
316
315
this . #deleteByUrlQuery. run ( this . #makeValueUrl( key ) )
317
316
}
318
317
319
- /**
320
- * This method is called to prune the cache when it exceeds the maximum number
321
- * of entries. It removes half the entries in the cache, ordering them the oldest.
322
- *
323
- * @returns {Number } The number of entries removed
324
- */
325
- prune ( ) {
326
- if ( this . size <= this . #maxCount) {
318
+ #prune ( ) {
319
+ if ( this . #size <= this . #maxCount) {
327
320
return 0
328
321
}
329
322
@@ -348,7 +341,7 @@ class SqliteCacheStore {
348
341
* Counts the number of rows in the cache
349
342
* @returns {Number }
350
343
*/
351
- get size ( ) {
344
+ get # size ( ) {
352
345
const { total } = this . #countEntriesQuery. get ( )
353
346
return total
354
347
}
You can’t perform that action at this time.
0 commit comments