Skip to content

Latest commit

 

History

History
22 lines (17 loc) · 1.14 KB

README.md

File metadata and controls

22 lines (17 loc) · 1.14 KB

flight-shield Examples

Run any example locally after building the package:

npm run build
node examples/01-thundering-herd-demo.mjs
node examples/02-swr-xfetch-and-soft-purge.mjs
node examples/03-n-plus-one-batching.mjs
node examples/04-redis-fail-open-and-meta.mjs

Included Scripts

Script Demonstrates
01-thundering-herd-demo.mjs singleFlight.doWithMeta() collapsing 200 concurrent callers into 1 DB call + clone: true isolation
02-swr-xfetch-and-soft-purge.mjs StampedeShield dynamic ttlMs, shouldCache, softPurge(), and waitUntil
03-n-plus-one-batching.mjs BatchFlight deduplicating N+1 loads into 1 batched Map lookup with partial missing keys
04-redis-fail-open-and-meta.mjs createRedisAdapter() + fail-open onCacheError fallback + getOrSetWithMeta() telemetry

See the main README for full Next.js App Router (unstable_after), Cloudflare Workers (ctx.waitUntil), Express/Redis, and GraphQL context patterns.