diff --git a/package.json b/package.json index 2b3118e..b14ba9e 100644 --- a/package.json +++ b/package.json @@ -42,9 +42,9 @@ "prettier": "@pengzhanbo/prettier-config", "dependencies": { "debug": "^4.3.4", + "lru-cache": "^9.1.1", "magic-string": "^0.30.0", "path-to-regexp": "^6.2.1", - "quick-lru": "^6.1.1", "rgb-hex": "^4.0.1", "sharp": "^0.32.1" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 84ffa6b..9d35525 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4,15 +4,15 @@ dependencies: debug: specifier: ^4.3.4 version: 4.3.4 + lru-cache: + specifier: ^9.1.1 + version: 9.1.1 magic-string: specifier: ^0.30.0 version: 0.30.0 path-to-regexp: specifier: ^6.2.1 version: 6.2.1 - quick-lru: - specifier: ^6.1.1 - version: 6.1.1 rgb-hex: specifier: ^4.0.1 version: 4.0.1 @@ -2848,6 +2848,11 @@ packages: dependencies: yallist: 4.0.0 + /lru-cache@9.1.1: + resolution: {integrity: sha512-65/Jky17UwSb0BuB9V+MyDpsOtXKmYwzhyl+cOa9XUiI4uV2Ouy/2voFP3+al0BjZbJgMBD8FojMpAf+Z+qn4A==} + engines: {node: 14 || >=16.14} + dev: false + /magic-string@0.30.0: resolution: {integrity: sha512-LA+31JYDJLs82r2ScLrlz1GjSgu66ZV518eyWT+S8VhyQn/JL0u9MeBOvQMGYiPk1DBiSN9DDMOcXvigJZaViQ==} engines: {node: '>=12'} @@ -3438,11 +3443,6 @@ packages: engines: {node: '>=8'} dev: true - /quick-lru@6.1.1: - resolution: {integrity: sha512-S27GBT+F0NTRiehtbrgaSE1idUAJ5bX8dPAQTdylEyNlrdcH5X4Lz7Edz3DYzecbsCluD5zO8ZNEe04z3D3u6Q==} - engines: {node: '>=12'} - dev: false - /rc9@2.1.0: resolution: {integrity: sha512-ROO9bv8PPqngWKoiUZU3JDQ4sugpdRs9DfwHnzDSxK25XtQn6BEHL6EOd/OtKuDT2qodrtNR+0WkPT6l0jxH5Q==} dependencies: diff --git a/src/cache.ts b/src/cache.ts index c2048bf..d92d602 100644 --- a/src/cache.ts +++ b/src/cache.ts @@ -1,10 +1,10 @@ -import QuickLRU from 'quick-lru' +import { LRUCache } from 'lru-cache' import type { ImageCacheItem } from './types' -export const bufferCache = new QuickLRU<string, ImageCacheItem>({ - maxSize: 500, +export const bufferCache = new LRUCache<string, ImageCacheItem>({ + max: 500, }) -export const contentCache = new QuickLRU<string, string>({ - maxSize: 500, +export const contentCache = new LRUCache<string, string>({ + max: 500, })