Skip to content

Commit f0f0e7f

Browse files
Fdawgsgurgunday
andauthored
build(deps): replace mnemonist with toad-cache (#366)
* build(deps): replace mnemonist with toad-cache * Update vary.js Co-authored-by: Gürgün Dayıoğlu <[email protected]> Signed-off-by: Frazer Smith <[email protected]> * refactor(vary): replace lru with fifo cache --------- Signed-off-by: Frazer Smith <[email protected]> Co-authored-by: Gürgün Dayıoğlu <[email protected]>
1 parent 576bb77 commit f0f0e7f

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
},
7272
"dependencies": {
7373
"fastify-plugin": "^5.0.0",
74-
"mnemonist": "0.40.3"
74+
"toad-cache": "^3.7.0"
7575
},
7676
"tsd": {
7777
"directory": "test"

vary.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict'
22

3-
const LRUCache = require('mnemonist/lru-cache')
3+
const { FifoMap: FifoCache } = require('toad-cache')
44

55
/**
66
* Field Value Components
@@ -67,7 +67,7 @@ function parse (header) {
6767
}
6868

6969
function createAddFieldnameToVary (fieldname) {
70-
const headerCache = new LRUCache(1000)
70+
const headerCache = new FifoCache(1000)
7171

7272
validateFieldname(fieldname)
7373

@@ -92,7 +92,7 @@ function createAddFieldnameToVary (fieldname) {
9292
header = header.join(', ')
9393
}
9494

95-
if (!headerCache.has(header)) {
95+
if (headerCache.get(header) === undefined) {
9696
const vals = parse(header)
9797

9898
if (vals.indexOf('*') !== -1) {

0 commit comments

Comments
 (0)