File tree Expand file tree Collapse file tree 1 file changed +4
-11
lines changed
Expand file tree Collapse file tree 1 file changed +4
-11
lines changed Original file line number Diff line number Diff line change @@ -265,8 +265,6 @@ class SqliteCacheStore {
265265 callback ( )
266266 } ,
267267 final ( callback ) {
268- store . prune ( )
269-
270268 const existingValue = store . #findValue( key , true )
271269 if ( existingValue ) {
272270 // Updating an existing response, let's overwrite it
@@ -283,6 +281,7 @@ class SqliteCacheStore {
283281 existingValue . id
284282 )
285283 } else {
284+ store . #prune( )
286285 // New response, let's insert it
287286 store . #insertValueQuery. run (
288287 url ,
@@ -316,14 +315,8 @@ class SqliteCacheStore {
316315 this . #deleteByUrlQuery. run ( this . #makeValueUrl( key ) )
317316 }
318317
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) {
327320 return 0
328321 }
329322
@@ -348,7 +341,7 @@ class SqliteCacheStore {
348341 * Counts the number of rows in the cache
349342 * @returns {Number }
350343 */
351- get size ( ) {
344+ get # size ( ) {
352345 const { total } = this . #countEntriesQuery. get ( )
353346 return total
354347 }
You can’t perform that action at this time.
0 commit comments