Skip to content

SmartTieredCache

Source: src/Cloudflare/Cache/SmartTieredCache.ts

The Smart Tiered Cache setting of a Cloudflare zone (/zones/{zone_id}/cache/tiered_cache_smart_topology_enable).

Smart Tiered Cache dynamically selects the single best upper-tier data center for each origin, reducing requests that reach the origin. The setting is a zone singleton — it always exists on every zone (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).

Only one SmartTieredCache resource per zone makes sense — two instances managing the same zone would fight over the singleton.

Enable Smart Tiered Cache on a zone

const zone = yield* Cloudflare.Zone("Site", { name: "example.com" });
yield* Cloudflare.SmartTieredCache("SmartCache", {
zoneId: zone.zoneId,
});

Explicitly disable Smart Tiered Cache

yield* Cloudflare.SmartTieredCache("SmartCache", {
zoneId: zone.zoneId,
enabled: false,
});