Layercache
Production-ready caching for Node.js

Stack memory, Redis, disk, and Memcached behind one compact API with single-flight fetches, tag invalidation, stale serving, and operational metrics.

npm
yarn
pnpm
bun
deno
npm install layercache
LayercacheLayercache
๐Ÿ“š

Multi-layer stack

Memory, Redis, disk, and Memcached share one read-through interface with automatic backfill.

๐Ÿšฆ

Single-flight fetches

Concurrent callers collapse into one fetch locally, with Redis leases for distributed coordination.

๐ŸŽฏ

Precise invalidation

Expire by tag, prefix, pattern, or namespace without throwing away stale fallback state.

๐Ÿ›ก๏ธ

Operational guardrails

Circuit breakers, timeout controls, Prometheus metrics, OpenTelemetry spans, and CLI inspection.

๐Ÿ”Œ

Framework integrations

Middleware and helpers for Express, Fastify, Hono, tRPC, GraphQL, and OpenTelemetry.

๐Ÿงช

Browser playground

Try Layercache examples in an isolated worker sandbox directly in the documentation site.