Skip to main content

Cache tags, soft-stale ISR, and after()

Sean DubbFounder, Easel.sh

Purge by cache tag across the edge CDN, Runtime Cache, and Incremental Static Regeneration (ISR) together. Next.js revalidateTag, revalidatePath, and after() follow the same multi-layer model as Vercel.

Tag once, expire everywhere

Attach the same tag string to CDN responses (Cache-Tag) and Runtime Cache writes. When you call revalidateTag or expireTag, Easel updates the shared tag clock, marks matching ISR pages soft-stale, clears tagged Runtime Cache entries when you expire them, and purges matching edge objects for the deployment.

Schedule work after the response

Schedule revalidation after you return:

import { after } from "next/server";
import { revalidateTag } from "next/cache";

export async function POST() {
  after(() => {
    revalidateTag("products");
  });
  return Response.json({ ok: true });
}

The response goes out first. Tag expiry runs in the background for that request. See Invalidate and revalidate cached content and Runtime Cache.

Talk to us

Book a short call and we'll walk through your current infrastructure bill together.

Talk to us