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",