Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Cache insights for Hapi servers

NotificationsYou must be signed in to change notification settings

jameswragg/hapi-cache-stats

Repository files navigation

Cache insights forHapi.js servers withCatbox cache policies

Installation

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.

Main policy stats viewscreenshot of policy stats

Seeing what methods use the cache policy & their individual statsscreenshot showing the method stats

Plugin options

  • 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: '*' } }

Development

To contribute to the project:

  1. Clone the repo
  2. npm install
  3. 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

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp