Skip to content

Commit

Permalink
chore: swap toad-cache in for hashlru (#418)
Browse files Browse the repository at this point in the history
  • Loading branch information
mweberxyz committed Mar 1, 2024
1 parent 37cdde2 commit 988042f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
},
{
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 988042f

Please sign in to comment.