Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: encapsulate cache as decorator #416

Merged
merged 2 commits into from
Mar 1, 2024

Conversation

mweberxyz
Copy link
Contributor

In preparation for potentially migrating from hashlru to toad-cache -- encapsulate the lru as a decorator.

This will:

  • make the tests agnostic to underlying cache implementations
  • aid in benchmarking differences between cache implementations
  • drop a devDependency

Benchmarks

Benchmark Node 18 PR Node 18 Base Node 20 PR Node 20 Base Node 21 PR Node 21 Base
express.js 8351 8231 8815 8591 8439 8447
fastify.js 42975 41247 43391 42687 42271 42463
fastify-art.js 9511 9431 10487 11567 9287 9271
fastify-dot.js 47199 46367 47615 46751 47839 46975
fastify-eta.js 27199 27007 30095 29327 37695 35327
fastify-pug.js 45183 45759 46367 44735 46719 46559
fastify-twig.js 30175 35423 38911 38335 40831 39167
fastify-liquid.js 7531 6323 7663 7667 7803 7711
fastify-mustache.js 31855 31503 34079 35423 33887 33951
fastify-nunjucks.js 41599 41631 42655 43167 43295 42463
fastify-ejs-async.js 35039 35647 43263 44095 45247 43327
fastify-ejs-minify.js 11855 12567 14463 15383 13823 14407
fastify-handlebars.js 25231 25647 31055 31727 26495 27679
fastify-ejs-local-layout.js 26831 26159 31487 31583 31039 31167
fastify-ejs-global-layout.js 34527 32479 34975 40543 40159 41375

Checklist

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mweberxyz mweberxyz mentioned this pull request Feb 28, 2024
3 tasks
index.js Outdated Show resolved Hide resolved
@mweberxyz mweberxyz mentioned this pull request Feb 28, 2024
2 tasks
@mweberxyz mweberxyz force-pushed the refactor/encapsulate-cache-alt branch from c50583b to 405554f Compare March 1, 2024 02:05
@mweberxyz
Copy link
Contributor Author

Merge conflicts resolved.

@mcollina mcollina merged commit 37cdde2 into fastify:master Mar 1, 2024
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants