Menu

Data Cache for Next.js

Last updated November 6, 2025

Data Cache is available in Beta on all plans

Data cache is a specialized, granular cache introduced with Next.js 13 for storing segment-level data while using Next.js App Router. When using Next.js caching APIs such as fetch or unstable_cache, Vercel automatically scaffolds globally distributed infrastructure for you with no additional configuration.

For Next.js 15 and above, see Runtime Cache for the recommended caching approach. Data cache is for Next.js 14 and below.

Data cache is best when your Next.js App Router pages fetch data that can be reused across requests:

  • API calls that return the same data across multiple requests
  • Database queries that don't change frequently
  • Data fetching in server components or route handlers
  • Pages with a mix of static and dynamic data

Data cache is not a good fit for:

  • User-specific data that differs for each request
  • Data that must be fresh on every request
  • Complete HTTP responses (use CDN Cache instead)
  • Next.js 15 and above (use Runtime Cache instead)

Data cache stores data in a regional cache close to where your function executes. It has the following characteristics:

  • Regional: Every region in which your function runs has an independent cache, so data used in server-side rendering or route handlers is cached close to where the function executes
  • Isolated: Data cache is isolated per Vercel project and deployment environment (production or preview)
  • Persistent across deployments: Cached data persists across deployments unless you explicitly invalidate it
  • Time-based revalidation: All cached data can define a revalidation interval, after which the data is marked as stale, triggering a re-fetch from origin
  • On-demand revalidation: Any data can be triggered for revalidation on-demand, regardless of the revalidation interval. The revalidation propagates to all regions within 300ms
  • Tag-based revalidation: Next.js allows associating tags with data, which can be used to revalidate all data with the same tag at once with revalidateTag

When you deploy a Next.js project that uses App Router to Vercel, data cache is automatically enabled to cache segment-level data alongside ISR.

app/page.tsx
type BlogPosts = Awaited<ReturnType<typeof getStaticProps>>['props']['blog'];
 
export default function Page({ blog }: { blog: BlogPosts }) {
  return (
    <main>
      <pre>{JSON.stringify(blog, null, 2)}</pre>
    </main>
  );
}
 
export async function getStaticProps() {
  const res = await fetch('https://api.vercel.app/blog');
  const blog = await res.json();
 
  return {
    props: {
      blog,
    },
    revalidate: 3600, // 1 hour
  };
}
app/page.jsx
export default function Page({ blog }) {
  return (
    <main>
      <pre>{JSON.stringify(blog, null, 2)}</pre>
    </main>
  );
}
 
export async function getStaticProps() {
  const res = await fetch('https://api.vercel.app/blog');
  const blog = await res.json();
 
  return {
    props: {
      blog,
    },
    revalidate: 3600, // 1 hour
  };
}
app/page.tsx
export default async function Page() {
  const res = await fetch('https://api.vercel.app/blog', {
    next: {
      revalidate: 3600, // 1 hour
    },
  });
  const data = await res.json();
 
  return (
    <main>
      <pre>{JSON.stringify(data, null, 2)}</pre>
    </main>
  );
}
app/page.jsx
export default async function Page() {
  const res = await fetch('https://api.vercel.app/blog', {
    next: {
      revalidate: 3600, // 1 hour
    },
  });
  const data = await res.json();
 
  return (
    <main>
      <pre>{JSON.stringify(data, null, 2)}</pre>
    </main>
  );
}
app/page.tsx
export default async function Page() {
  const res = await fetch('https://api.vercel.app/blog', {
    next: {
      tags: ['blog'], // Invalidate with revalidateTag('blog') on-demand
    },
  });
  const data = await res.json();
 
  return '...';
}
app/page.jsx
export default async function Page() {
  const res = await fetch('https://api.vercel.app/blog', {
    next: {
      tags: ['blog'], // Invalidate with revalidateTag('blog') on-demand
    },
  });
  const data = await res.json();
 
  return '...';
}
app/actions.ts
'use server';
 
import { revalidateTag } from 'next/cache';
 
export default async function action() {
  revalidateTag('blog');
}
app/actions.js
'use server';
 
import { revalidateTag } from 'next/cache';
 
export default async function action() {
  revalidateTag('blog');
}

Vercel persists cached data across deployments, unless you explicitly invalidate it using framework APIs like res.revalidate, revalidateTag, and revalidatePath, or by manually purging the cache. Cache is not updated at build time. When invalidated, Vercel updates the data at run time, triggered by the next request to the invalidated path.

When the system triggers a revalidation, Vercel marks the corresponding path or cache tag as stale in every region. The next request to that path or tag, regardless of the region, initiates revalidation and updates the cache globally. Vercel purges and updates the regional cache in all regions within 300ms.

You need to have a member role to perform this task.

In some circumstances, you may need to delete all cached data and force revalidation. You can do this by purging the data cache:

  1. Under your project, go to the Settings tab.
  2. In the left sidebar, select Caches.
  3. In the Data Cache section, click Purge Data Cache.
  4. In the dialog, confirm that you wish to delete and click the Continue & Purge Data Cache button.

Purging your data cache will create a temporary increase in request times for users as new data needs to be refetched.

You can observe your project's data cache usage in the Observability tab under your project in the Vercel dashboard. The Runtime Cache tab provides visibility into what's stored in your project's data cache along with insights like your cache hit rate and the number of cache reads, cache writes, and on-demand revalidations.

You can also track data cache usage per request in the Logs tab under the log's request metrics section.

Data cache propertyLimit
Item size2 MB (items larger won't be cached)
Tags per item128 tags
Maximum tag length256 bytes

Data cache works alongside Incremental Static Regeneration (ISR) and CDN Cache:

ScenarioCache layer
Entirely static pagesISR
Pages with mix of static and dynamic dataData cache + ISR
Data fetched during function executionData cache
Complete HTTP responses (images, fonts, etc.)CDN cache

When a page contains entirely static data, Vercel uses ISR to generate the whole page. When a page contains a mix of static and dynamic data, the dynamic data is re-fetched when rendering the page. Data cache stores the static portion to avoid slow origin fetches.

Both Data cache and ISR support time-based revalidation, on-demand revalidation, and tag-based revalidation.


Was this helpful?

supported.