Introducing LazyLayers 9.0. Multi-layer caching, intelligent batching and outage recovery.

Explore what’s new

LazyLayers How it worksUpdated

Every read takes the shortest path.

Call getOrSet with a key and a loader. LazyLayers handles the rest: memory first, then the shared cache, then your loader, and the value fills every layer on the way back.

The read path

Three stacked layers: a lime L1 memory chip on top, a violet shared L2 below it, and the orange origin at the bottom. A read checks L1, then L2 on a miss, then calls the loader, and the value is returned up the right side. miss ↓ miss ↓ getOrSet(key, loader) L1memory in this process L2Redis or Cloudflare KV ORIGINyour database or API

Pick a layer to trace a read

A read goes down only as far as it must: L1, then L2, then your loader.
Explore how caching works

Distributed caching

More servers. Less repeated work.

As your application grows, every instance gets its own local cache. LazyLayers connects those instances through shared storage and an event bus.

  1. Three app instances ask a Redis drum for the lease on one key. The first gets it, loads once from the origin and stores the value. The other two are then woken with that value. LEASE REDIS LEASE ORIGIN · LOADED ONCE

    01

    Coordinate refreshes

    A Redis lease lets one server load a missing key while the others wait, then wakes them with the value. Your database sees one query, not one per server.

    Learn more
  2. Three app instances hang from a teal event bus. A write on the first travels along the bus and drops into the other two, which show a check mark and version v2. WRITE v2 v2 v2 invalidate · prime · fan out

    02

    Share invalidations

    Invalidate a key, a pattern or a tag, and an event bus tells every other instance to drop its local copy.

    Learn more
  3. A read heads for the Redis drum, which is faded with a red cross, and stops. It goes straight to the origin instead, which shows a check and sends the value back. REDIS DOWN ORIGIN ANSWERS

    03

    Handle temporary failures

    Stale values, bounded retries and circuit breakers soften slow or unavailable dependencies. If nothing usable is cached, a request can still fail.

    Learn more

Deployment

Caching that fits your stack.

Start with the infrastructure you already have.

One app instance with its own lime L1 chip. ONE PROCESS

In memory

A lightweight, bounded cache for a single Node.js process.

Get started
Two app instances joined by a lime floor rail to a shared violet Redis drum. Values travel from the drum to each instance in turn. SHARED L2 + LEASES

Redis

Shared caching, coordinated refreshes and invalidation across application instances.

Explore Redis setup
Three amber Worker isolates, each with a small L1, joined by a rail to a Cloudflare KV drum. ISOLATES → KV

Cloudflare

Cache at the edge with Workers KV, or use Durable Objects for shared coordination.

Explore Cloudflare setup
Two app instances, each with its own L1, joined by dashed teal change-stream paths to a coordination block. LOCKS · COUNTERS · STREAMS

MongoDB

Coordinate locks, counters, rate limits and invalidation through the MongoDB you already run.

Explore MongoDB coordination

Works with

  • Node.js
  • TypeScript
  • Hono
  • Express
  • Fastify
  • Redis
  • Cloudflare
  • NATS
  • RabbitMQ
  • MongoDB
  • Prometheus
  • OpenTelemetry

FAQ

Before you get started

Read all FAQs

Do I need Redis?

No. LazyLayers works as a standalone in-memory cache. Redis is optional, for applications that need a shared cache and refreshes coordinated across servers.

Does it work with my framework?

LazyLayers is framework-independent. Use it with Hono, Express, Fastify or any other Node.js application, and in Cloudflare Workers.

What happens if my database goes down?

With fail-safe enabled, LazyLayers returns the last good value it kept for that key, 30 seconds past expiry by default. Requests can still fail when no usable value exists.

Does it work on Cloudflare Workers?

Yes. LazyLayers has a Worker-safe entry point with Cloudflare KV support. KV is eventually consistent and has no Redis-style loader lease across isolates, so different isolates can each load the same missing key.