Skip to content

Commit

Permalink
perf: replace quick-lru to lru-cache
Browse files Browse the repository at this point in the history
  • Loading branch information
pengzhanbo committed May 13, 2023
1 parent 72e6a3a commit ae040c1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
16 changes: 8 additions & 8 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions src/cache.ts
Original file line number Diff line number Diff line change
@@ -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,
})

0 comments on commit ae040c1

Please sign in to comment.