upgrade deps

pull/396/head
starknt 2024-11-18 10:43:58 +08:00
parent feddcc5257
commit 609c9c782d
3 changed files with 9 additions and 5 deletions

View File

@ -20,7 +20,7 @@
"is-browser": "^2.1.0", "is-browser": "^2.1.0",
"json5": "^2.2.3", "json5": "^2.2.3",
"lodash": "^4.17.20", "lodash": "^4.17.20",
"lru-cache": "^6.0.0", "lru-cache": "^7.15.0",
"node-forge": "^1.3.1", "node-forge": "^1.3.1",
"stream-throttle": "^0.1.3", "stream-throttle": "^0.1.3",
"through2": "^4.0.2", "through2": "^4.0.2",

View File

@ -1,11 +1,13 @@
const LRU = require('lru-cache') const LRUCache = require('lru-cache').default
const log = require('../../utils/util.log') const log = require('../../utils/util.log')
const cacheSize = 1024 const cacheSize = 1024
class ChoiceCache { class ChoiceCache {
constructor () { constructor () {
this.cache = new LRU(cacheSize) this.cache = new LRUCache({
maxSize: cacheSize,
})
} }
get (key) { get (key) {

View File

@ -1,4 +1,4 @@
const LRU = require('lru-cache') const LRUCache = require('lru-cache').default
const log = require('../../utils/util.log') const log = require('../../utils/util.log')
const { DynamicChoice } = require('../choice/index') const { DynamicChoice } = require('../choice/index')
@ -23,7 +23,9 @@ class IpCache extends DynamicChoice {
module.exports = class BaseDNS { module.exports = class BaseDNS {
constructor () { constructor () {
this.cache = new LRU(cacheSize) this.cache = new LRUCache({
maxSize: cacheSize,
})
} }
count (hostname, ip, isError = true) { count (hostname, ip, isError = true) {