Refactor cache entry removal to use Set for removalQueue
| @@ -50,7 +50,7 @@ const diskCache = { | ||
| 50 | 50 | */ |
| 51 | 51 | _removeCacheEntries: async function() { |
| 52 | 52 | try { |
| 53 | 53 | if (!useDiskCache || this.removalQueue.lengthsize === 0) { |
| 54 | 54 | return; |
| 55 | 55 | } |
| 56 | 56 | |
| @@ -62,7 +62,7 @@ const diskCache = { | ||
| 62 | 62 | } |
| 63 | 63 | } |
| 64 | 64 | console.info('Removed cache entries:', this.removalQueue); |
| 65 | 65 | this.removalQueue = [].clear(); |
| 66 | 66 | } catch (error) { |
| 67 | 67 | console.error('Error while removing cache entries:', error); |
| 68 | 68 | } |
| @@ -84,9 +84,9 @@ const diskCache = { | ||
| 84 | 84 | }, |
| 85 | 85 | /** |
| 86 | 86 | * Queue for removal of cache entries. |
| 87 | 87 | * @type {Set<string[]>} |
| 88 | 88 | */ |
| 89 | 89 | removalQueue: []new Set(), |
| 90 | 90 | }; |
| 91 | 91 | |
| 92 | 92 | /** |
| @@ -166,7 +166,7 @@ async function writeCharacterData(inputFile, data, outputFile, request, crop = u | ||
| 166 | 166 | } |
| 167 | 167 | } |
| 168 | 168 | if (useDiskCache && !Buffer.isBuffer(inputFile)) { |
| 169 | 169 | diskCache.removalQueue.pushadd(inputFile); |
| 170 | 170 | } |
| 171 | 171 | /** |
| 172 | 172 | * Read the image, resize, and save it as a PNG into the buffer. |