- Notifications
You must be signed in to change notification settings - Fork0
jameswragg/hapi-cache-stats
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Cache insights forHapi.js servers withCatbox cache policies
npm i @jameswragg/hapi-cache-stats
Register the plugin as (one of) the first plugins on the server to ensure policies are caught.
constHapi=require('@hapi/hapi');constHapiCacheStats=require('@jameswragg/hapi-cache-stats');(async()=>{constserver=Hapi.server({port:3000});awaitserver.register({plugin:HapiCacheStats,options:{// options here},});// app code here - using Catbox cachesawaitserver.start();console.log(`Start adding at${server.info.uri}`);})();
Then visithttp://localhost:3000/cache-stats
for live, real-time stats on all registered cache policies & method stats.
Seeing what methods use the cache policy & their individual stats
base
- route to mount the UI on, default:'/cache-stats'
snapshot
- object with the following settings regarding snapshots:interval
- every X seconds, default:5
retention
: how many snapshots to retain, default:60
socketIo
- socket.ioserver options, default:{ cors: { origin: '*' } }
To contribute to the project:
- Clone the repo
npm install
npm run dev
- will file up an example server with policies, caches and a Vite server to host the frontend
Then append?dev
to the url e.g.http://localhost:3000/cache-stats?dev
. This will load the Vue front-end via the Vite server instead of built assets, supporting HMR on change etc.
About
Cache insights for Hapi servers
Resources
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
No releases published
Packages0
No packages published
Uh oh!
There was an error while loading.Please reload this page.