惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Cisco Talos Blog
Cisco Talos Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
爱范儿
爱范儿
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Jina AI
Jina AI
雷峰网
雷峰网
The Register - Security
The Register - Security
The Cloudflare Blog
博客园 - 【当耐特】
M
MIT News - Artificial intelligence
I
InfoQ
博客园 - 三生石上(FineUI控件)
H
Help Net Security
博客园 - 司徒正美
Vercel News
Vercel News
WordPress大学
WordPress大学
S
SegmentFault 最新的问题
云风的 BLOG
云风的 BLOG
B
Blog
Google DeepMind News
Google DeepMind News
B
Blog RSS Feed
L
LangChain Blog
人人都是产品经理
人人都是产品经理
GbyAI
GbyAI
T
The Blog of Author Tim Ferriss
T
Tailwind CSS Blog
aimingoo的专栏
aimingoo的专栏
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Recorded Future
Recorded Future
小众软件
小众软件
Martin Fowler
Martin Fowler
罗磊的独立博客
Stack Overflow Blog
Stack Overflow Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
酷 壳 – CoolShell
酷 壳 – CoolShell
腾讯CDC
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Apple Machine Learning Research
Apple Machine Learning Research
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园 - Franky
Hugging Face - Blog
Hugging Face - Blog
Y
Y Combinator Blog
V
Visual Studio Blog
F
Fortinet All Blogs
Microsoft Azure Blog
Microsoft Azure Blog
大猫的无限游戏
大猫的无限游戏
Engineering at Meta
Engineering at Meta
N
Netflix TechBlog - Medium
V
V2EX
Blog — PlanetScale
Blog — PlanetScale

Flavio Copes

Workers Cache: a cache in front of your Cloudflare Worker Cloudflare Drop: drag a folder, get a live site Temporary Cloudflare accounts: agents can now deploy without signing up Moondream 3.1 on Workers AI: fast vision at the edge inferencecost.dev: what will AI inference cost you at 10k users? Sitebase: all the features your website needs, in one place StackPlan: figure out where to deploy your app, and what it The Summer of Code How I generate an Open Graph image for every post New: 90 free tools for developers How I added search to my static site with Pagefind How to rebuild a Cloudflare site on a schedule Cloudflare Email Workers: run code when an email arrives Cloudflare Turnstile: stop bots without annoying CAPTCHAs Cloudflare Workers: secrets and environments Cloudflare Workers observability: logs and traces Cloudflare Analytics Engine: store and query metrics The AI Workshop (July 2026 cohort) Cloudflare Cron Triggers: run a Worker on a schedule Cloudflare Durable Objects: state that lives in one place Cloudflare Queues: run work in the background Cloudflare R2: object storage without egress fees Cloudflare KV: a key-value store for your Workers Cloudflare D1: a SQL database for your Workers Serving a website with Cloudflare Workers static assets Wrangler: the Cloudflare Workers command line tool Executor: one gateway to connect your AI agent to every tool Cloudflare Workers: your first serverless function Vercel eve: an open framework for building AI agents Flue: the open framework for building AI agents Val Town: write and deploy code in seconds A hands-on guide to The Agency, a collection of AI agents The AI Workshop (June 2026 cohort) The AI Workshop (May 2026 cohort) The AI Workshop (Apr 2026 cohort)
How the Cloudflare Pages build cache works
Flavio Copes · 2026-07-08 · via Flavio Copes

By Flavio Copes

How the Cloudflare Pages build cache speeds up deploys, which directories it restores for each framework, and how to keep your own caches between builds.

~~~

Every time you push, Cloudflare Pages runs a fresh build from scratch. Fresh means slow: it reinstalls your dependencies and rebuilds everything, every time.

The build cache fixes part of this. It saves some directories after a build and restores them on the next one.

It’s off by default. You turn it on in the dashboard, in your Pages project’s build settings.

What it actually caches

The build cache doesn’t save your whole project. It saves two specific things.

First, your package manager’s cache, so installs are faster:

  • npm caches .npm
  • pnpm caches .pnpm-store
  • yarn caches .cache/yarn

Second, one cache directory per framework. Cloudflare detects your framework and restores its known cache folder:

  • Astro: node_modules/.astro
  • Next.js: .next/cache
  • Gatsby: .cache and public
  • Nuxt: node_modules/.cache/nuxt

That’s the important detail. It’s an allow-list. Cloudflare only restores those exact folders, and you can’t add your own.

The gotcha that caught me

I generate an Open Graph image for every post at build time. The tool caches each image so it doesn’t redraw the ones that didn’t change.

By default it cached them in node_modules/.astro-og-canvas. That folder isn’t on Cloudflare’s list, so it got thrown away after every build. Every deploy regenerated all 1800 images.

The fix

The fix is to cache inside a folder Cloudflare keeps. For Astro, that’s node_modules/.astro.

So I pointed the cache there:

getImageOptions: (path, page) => ({
  cacheDir: './node_modules/.astro/astro-og-canvas',
  title: page.title,
})

Now the cache rides along with Astro’s own cache. After the first deploy seeds it, only new and changed posts get regenerated.

My build went from redrawing everything to redrawing almost nothing. A cold build takes about 45 seconds. With the cache warm, about 12.

The takeaway

If a tool in your build writes a cache, check where it writes it. On Cloudflare Pages, put it inside your framework’s cache folder, or it won’t survive the next deploy.

~~~

Related posts about cloudflare: