---
title: "Netlify gives you full control over caching with cache ID"
description: "Netlify-Cache-ID provides a way to label your cached content across Netlify Edge so it’s persistent across deploys, while still being able to be purged granularly, almost immediately, and globally."
source: "https://www.netlify.com/blog/full-control-over-caching-with-cache-id/"
last_updated: "2026-07-11T03:08:37.000Z"
---
One of the key features offered by Netlify from the very beginning is the ability to do [atomic deploys](https://docs.netlify.com/site-deploys/overview/), which ensure your site is never in an inconsistent state while you’re uploading a new deploy. Atomic deploys are part of what allows developers to **focus on what’s important**, enabling them to build their website without having to think on what files have changed or what files to update. Netlify achieves this by labelling each cached object with an internal cache ID specific to your site and context, so that a new deploy for that site and context will cause all objects labelled with that ID to be invalidated on Netlify Edge.

Additionally, on October of last year [we released cache tags](https://www.netlify.com/blog/cache-tags-and-purge-api-on-netlify/). With cache tags you can specify `Cache-Tag` or `Netlify-Cache-Tag` response headers, and then use our [purge API](https://docs.netlify.com/platform/caching/#on-demand-invalidation) to invalidate any object with a given tag from Netlify Edge in between deployments, without having to wait for the object’s [lifetime to expire](https://docs.netlify.com/platform/caching/#supported-cache-control-headers). Cache tags are a great way to invalidate content on-demand without losing the atomic deploy guarantee.

However, **sometimes you don’t want your cached content to be invalidated on new deploys**. For example, you might have a site proxying to a CMS server with a weekly release cycle. In this case, any deploy happening in between releases will invalidate your cached CMS content and cause Netlify Edge to revalidate it. This can affect performance, increase bandwidth spend, and put unnecessary strain on the CMS server.

**Netlify-Cache-ID** provides a way to label your cached content across Netlify Edge so it’s persistent across deploys, while still being able to be purged granularly, almost immediately, and globally.

### Netlify-Cache-ID

Netlify now supports a `Netlify-Cache-ID` response header, allowing you to associate an object — or collection of cached objects — to an ID that can be invalidated simultaneously across all of Netlify’s edge network. Objects associated with a `Netlify-Cache-ID` will not be invalidated when your site is deployed, but you still have the flexibility to decide whether and when they should be cached or not.

Here’s an example of a proxied response from a “products API” that will be cached on Netlify Edge for up to one year. The content is identified using `Netlify-Cache-ID` with `productID-1` and `products`, which allow you to identify your content with different levels of granularity. Netlify Edge will use those values as the cache IDs instead of the internal cache ID, and the content will not be invalidated on a new deploy.

```
GET /products/productID-1 HTTP/2Host: your-api.com...
HTTP/2 200Content-Type: text/htmlCDN-Cache-Control: public, max-age=31536000, must-revalidate // Cache for up to one year on Netlify's EdgeCache-Control: public, max-age=0, must-revalidate // Tell browsers to always revalidateNetlify-Cache-ID: productID-1,products // Tag all product responses with these tags
```

Similarly to `Cache-Tag` and `Netlify-Cache-Tag`, content tagged with this header can be purged using Netlify’s purge API. `Netlify-Cache-ID` values are automatically registered as cache tags that you can use to purge objects by tag. The following function uses the capabilities of [Netlify’s Improved Compute](https://www.netlify.com/blog/introducing-netlify-functions-2-0/) and invokes the purge API to purge all the site’s content tagged with `products` —while leaving the remaining site’s content cached on the CDN.

```
import { Config, purgeCache } from "@netlify/functions";
export default async () => {  // set `productID-1` instead to invalidate only a specific product's content  const tags = ["products"];  await purgeCache({ tags });
  return new Response("Purged successfully!", { status: 202 });};
export const config: Config = {  path: "/purge"};
```

`Cache-Control` directives are still respected so you can customise how long you want your objects to stay cached in case you don’t want to have to purge your content on-demand. Moreover, you can still take advantage of the [Cache-Tags](https://www.netlify.com/blog/cache-tags-and-purge-api-on-netlify/) feature for added flexibility.

Visit our [documentation](https://docs.netlify.com/platform/caching/#opt-out-of-automatic-invalidation) for more information on how to get started and learn more about how these features work together.

Let us know what you think – head over to the [forums](https://community.netlify.com/) and leave us a note.

### Share

-   [X (fka Twitter)](https://twitter.com/intent/tweet?text=Full control over caching with cache ID&url=https://www.netlify.com/blog/full-control-over-caching-with-cache-id/)
-   [LinkedIn](https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fwww.netlify.com%2Fblog%2Ffull-control-over-caching-with-cache-id%2F)
-   [Facebook](https://www.facebook.com/sharer.php?u=https://www.netlify.com/blog/full-control-over-caching-with-cache-id/)
-   [Bluesky](https://bsky.app/intent/compose?text=Full control over caching with cache ID+https://www.netlify.com/blog/full-control-over-caching-with-cache-id/)

* * *

### Tags

-   [feature](/blog/tags/feature/)
-   [cache invalidation](/blog/tags/cache-invalidation/)

## Keep reading

![](/_astro/b7970e0a0172fbde93b81e2dd212f135c7942ce6-2400x1260_1XrJhH.webp)

News & Announcements October 13, 2023

[

### Cache-tags & Purge API on Netlify

](/blog/cache-tags-and-purge-api-on-netlify)

-   ![Profile picture of Paulo Araújo](/_astro/daa935d2ed234741f03dd38a194860b9a971f887-450x450_1q8XMJ.webp)
    
    Paulo Araújo
    

![](/_astro/90866b7894bb5d250941afd6ad8e37f6c31ef0fa-2400x1260_Z1IN3YX.webp)

News & Announcements October 12, 2023

[

### Introducing Netlify Functions 2.0

](/blog/introducing-netlify-functions-2-0)

-   ![Profile picture of Eduardo Bouças](/_astro/52958f21e8450baf6d8e60302341a984e220c0cd-512x512_13VDlu.webp)
    
    Eduardo Bouças
    

## Recent posts

News & Announcements June 25, 2026

[

### Netlify Functions, designed for Agent Experience

](/blog/netlify-functions-designed-for-agent-experience)

-   ![Profile picture of Eduardo Bouças](/_astro/52958f21e8450baf6d8e60302341a984e220c0cd-512x512_13VDlu.webp)
    
    Eduardo Bouças
    

News & Announcements June 24, 2026

[

### How we measure Netlify’s Agent Experience

](/blog/how-we-measure-netlify-agent-experience)

-   ![Profile picture of Sean Roberts](/_astro/bbf2243f8171dbddd80ab2103622106cef84d125-512x512_Z1d2LKE.webp)
    
    Sean Roberts
    

Guides & Tutorials May 15, 2026

[

### How to build a real-time AI chatbot in minutes with Netlify Agent Runners (no backend)

](/blog/how-to-build-a-real-time-ai-chatbot-in-minutes-with-netlify-agent-runners-no-backend)

-   ![Profile picture of Nahrin Jalal](/_astro/f0e7c8f227a03fe58340c99ef5439d5a896c0733-272x272_Z23kDpD.webp)
    
    Nahrin Jalal
    

![](/_astro/3f255b372fa958df35802666ee33b4609b2d71bd-1200x1586_1VtE2D.webp)

### How do the best dev and marketing teams work together?

[Access the report](https://www.netlify.com/reports/2024-leadership-trend-report/access/)