From 30f5e539f1fbbc3acc718f63ffa57217ae1efb10 Mon Sep 17 00:00:00 2001 From: Igor Savin Date: Sun, 14 Jan 2024 12:06:32 +0200 Subject: [PATCH] Replace tiny-lru with toad-cache (#346) --- index.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 17c60927..70e7e7e8 100644 --- a/index.js +++ b/index.js @@ -1,7 +1,7 @@ 'use strict' const fp = require('fastify-plugin') -const { lru } = require('tiny-lru') +const { LruMap } = require('toad-cache') const querystring = require('fast-querystring') const fastContentTypeParse = require('fast-content-type-parse') const Stream = require('node:stream') @@ -32,7 +32,7 @@ const fastifyReplyFrom = fp(function from (fastify, opts, next) { const retryMethods = new Set(opts.retryMethods || [ 'GET', 'HEAD', 'OPTIONS', 'TRACE']) - const cache = opts.disableCache ? undefined : lru(opts.cacheURLs || 100) + const cache = opts.disableCache ? undefined : new LruMap(opts.cacheURLs || 100) const base = opts.base const requestBuilt = buildRequest({ http: opts.http, diff --git a/package.json b/package.json index 8ff62bbc..761d0e55 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,7 @@ "fast-querystring": "^1.0.0", "fastify-plugin": "^4.0.0", "pump": "^3.0.0", - "tiny-lru": "^11.0.0", + "toad-cache": "^3.7.0", "undici": "^5.19.1" }, "pre-commit": [