Skip to content

HTTP cache example

Sources: examples/http-cache/README.md | examples/http-cache/index.ts

Minimal embedded usage showing remember, stale reads, background refresh, invalidation, and metrics.

  • teams who want to start with CacheCore as a library inside another backend
  • read-through caching with remember
  • stale-while-revalidate behavior
  • tag invalidation and metrics inspection
  • Example path: examples/http-cache
  • Run command: pnpm example:http-cache
Terminal window
pnpm example:http-cache
  • the example warms a key, serves a stale read once, refreshes in the background, invalidates by tag, and prints metrics