Skip to content

Commit

Permalink
Added LRU, because i'm a idiot sandwitch
Browse files Browse the repository at this point in the history
This is the simplest implementation of LRU, which works faster than the npm package "lru-cache". Tests/benchmarks maybe will be added later.
  • Loading branch information
salwador committed Oct 19, 2024
1 parent 7fd88f4 commit 8cb5c88
Show file tree
Hide file tree
Showing 8 changed files with 332 additions and 77 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@ await server.register(FastifyBowser, {
cache: boolean = false;

// Cache limit. Will be automatically purged, if cache size reach limit.
cacheLimit: number = 100;
cacheLimit?: number = 100;

// Automatically cache purge interval in milliseconds.
cachePurgeTime: number = 60 * 5;
// Automatically cache purge interval in seconds.
// Disabled by default
cachePurgeTime?: number;
});

```
Expand Down
140 changes: 112 additions & 28 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 30 additions & 4 deletions dist/test/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/test/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bsnext/fastify-bowser",
"version": "1.0.0",
"version": "1.1.0",
"description": "A plugin for Fastify that adds the 'request.useragent' property to get header 'user-agent' parsed data.",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
Loading

0 comments on commit 8cb5c88

Please sign in to comment.