From 988042f542063a1b18601ddf52c188b5724e5240 Mon Sep 17 00:00:00 2001 From: Matt Weber <1062734+mweberxyz@users.noreply.github.com> Date: Fri, 1 Mar 2024 11:16:20 -0500 Subject: [PATCH] chore: swap toad-cache in for hashlru (#418) --- index.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 8b2b67e..b5afdce 100644 --- a/index.js +++ b/index.js @@ -3,14 +3,14 @@ const { readFile } = require('node:fs/promises') const fp = require('fastify-plugin') const { accessSync, existsSync, mkdirSync, readdirSync } = require('node:fs') const { basename, dirname, extname, join, resolve } = require('node:path') -const HLRU = require('hashlru') +const { LruMap } = require('toad-cache') const supportedEngines = ['ejs', 'nunjucks', 'pug', 'handlebars', 'mustache', 'art-template', 'twig', 'liquid', 'dot', 'eta'] const viewCache = Symbol('@fastify/view/cache') const fastifyViewCache = fp( async function cachePlugin (fastify, opts) { - const lru = HLRU(opts?.maxCache || 100) + const lru = new LruMap(opts.maxCache || 100) fastify.decorate(viewCache, lru) }, { diff --git a/package.json b/package.json index 4b99838..e734dfe 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "homepage": "https://github.com/fastify/point-of-view#readme", "dependencies": { "fastify-plugin": "^4.0.0", - "hashlru": "^2.3.0" + "toad-cache": "^3.7.0" }, "devDependencies": { "@fastify/pre-commit": "^2.0.2",