CacheReserve
Source:
src/Cloudflare/Cache/CacheReserve.ts
The Cache Reserve setting of a Cloudflare zone
(/zones/{zone_id}/cache/cache_reserve).
Cache Reserve is a large, persistent data store backed by R2 that serves
as the ultimate upper-tier cache, dramatically reducing origin egress for
cacheable content. The setting is a zone singleton — it always exists
on entitled zones (default off), so this resource never creates or
deletes anything physical. Reconcile patches the setting when the
observed value differs from the desired one; destroy restores the value
the setting had before Alchemy first managed it (captured as
initialValue).
Entitlement-gated: Cache Reserve is a usage-billed add-on that must
be purchased/enabled on the account. On zones without the subscription
both reads and writes fail with the typed SettingUnavailableForPlan
error (“this zone setting is not available for your plan type”).
Disabling Cache Reserve does not purge data already in reserve — set
clearOnDelete: true to run the asynchronous Cache Reserve Clear
operation on destroy (the provider polls until the clear completes).
Only one CacheReserve resource per zone makes sense — two instances
managing the same zone would fight over the singleton.
Managing Cache Reserve
Section titled “Managing Cache Reserve”Enable Cache Reserve on a zone
const zone = yield* Cloudflare.Zone("Site", { name: "example.com" });
yield* Cloudflare.CacheReserve("Reserve", { zoneId: zone.zoneId,});Clear stored data when the resource is destroyed
yield* Cloudflare.CacheReserve("Reserve", { zoneId: zone.zoneId, clearOnDelete: true,});