跳转到主要内容

Cache Reserve

import { Render, TabItem, Tabs, APIRequest, DashButton } from "~/components";

Content served from origin and getting cached in Cache Reserve, and Edge Cache Data Centers (T1=upper-tier, T2=lower-tier) on its way back to the client

Content in Cache Reserve is considered fresh based on the Edge Cache TTL setting, or your origin's Cache-Control headers if Edge Cache TTL is not set. After the freshness period expires, Cloudflare revalidates the asset with your origin the next time it is requested. This is the same behavior as in Cloudflare's regular CDN.

The retention period controls how long an asset stays in Cache Reserve before it is removed. Cache Reserve starts with a retention period of 30 days. If an asset is not requested within the retention period, it is removed from Cache Reserve. Requesting the asset resets the retention period.

Assets must meet certain criteria to use Cache Reserve.

Cache Reserve is a usage-based product and pricing is detailed below. While Cache Reserve does require a paid plan, users can continue to use Cloudflare’s CDN (without Cache Reserve) for free.

Enable Cache Reserve

A paid Cache Reserve plan is required.

  1. In the Cloudflare dashboard, go to the Cache Reserve page.

  2. Select Enable storage sync.

Refer to the Change Cache Reserve setting API for more information.

:::note[Note] You can pause Cache Reserve at any time. Pausing Cache Reserve means that Cloudflare’s network will no longer use Cache Reserve to serve data, but resources will remain in storage until they are purged or expired. :::

If you are an Enterprise customer and are interested in Cache Reserve, contact your account team to get help with your configuration.

Cache Reserve asset eligibility

Purge behavior

Purge forces a cache miss for matching Cache Reserve content, regardless of purge type. On the next request, your origin must deliver the content in full, and Cloudflare writes it to Cache Reserve again.

Purging by URL deletes the content from Cache Reserve. Purging by tag, hostname, prefix, or everything does not delete it right away. Matching content continues to incur storage costs until a later request replaces it or its retention period ends.

Invalidation keeps matching content in Cache Reserve and marks it as stale. If your origin responds with 304 Not Modified, Cloudflare reuses the stored content instead of fetching it again. Updating the stored content after the 304 response is a Class A operation.

To refresh metadata set by Cache Response Rules, such as cache tags, purge the affected content. A 304 Not Modified response to an invalidated request does not refresh this metadata.

To remove all data from Cache Reserve, refer to Cache Reserve clear button.

Limits

Usage

Like the standard CDN, Cache Reserve also uses the cf-cache-status header to indicate cache response statuses like MISS, HIT, and REVALIDATED. Cache Reserve cache misses and hits are factored into the dashboard's cache hit ratio.

Individual sampled requests that filled or were served by Cache Reserve are viewable via the CacheReserveUsed Logpush field.

Cache Reserve monthly operations and storage usage are viewable in the dashboard.

Pricing

Cache Reserve charges based on the total volume of data stored, along with two classes of operations on that data:

In most cases, a Cache Reserve miss will result in both one class A and one class B operation, and a Cache Reserve hit will result in one class B operation. Assets larger than 1 GB will incur more operations proportional to their size.

Cache Reserve pricing

Storage $0.015 / GB-month
Class A Operations (writes) $4.50 / million requests
Class B Operations (reads) $0.36 / million requests

Storage usage

Storage is billed using gigabyte-month (GB-month) as the billing metric. A GB-month is calculated by recording total bytes stored for the duration of the month.

For example:

  • Storing 1 GB for 30 days will be charged as 1 GB-month.
  • Storing 2 GB for 15 days will be charged as 1 GB-month.

Operations

Cache Reserve billing examples

Example 1

Assuming 1,000 assets (each 1 GB) are written to Cache Reserve at the start of the month and each asset is read 1,000 times, the estimated cost for the month would be:

Usage Billable Quantity Price
Class B Operations (1,000 assets) * (1,000 reads per asset) 1,000,000 $0.36
Class A Operations (1,000 assets) * (1 write per asset) 1,000 $4.50
Storage (1,000 assets) * (1GB per asset) 1,000 GB-months $15.00
TOTAL $19.86

Example 2

Assuming 1,000,000 assets (each 1 MB) are in Cache Reserve, and:

  • each asset expires and is rewritten into Cache Reserve 1 time per day
  • each asset is read 2 times per day

the estimated cost for the month would be:

Usage Billable Quantity Price
Class B Operations (1,000,000 assets) * (2 reads per day) * (30 days) 60,000,000 $21.60
Class A Operations (1,000,000 assets) * (1 write per day) * (30 days) 30,000,000 $135.00
Storage (1,000,000 assets) * (1MB per asset) 1,000 GB-months $15.00
TOTAL $171.60

Tips and best practices

Cache Reserve is designed for use with Tiered Cache enabled for maximum origin shielding. Using Cache Reserve without Tiered Cache may result in higher storage operation costs. The Cloudflare dashboard will warn you if you try to enable Cache Reserve without Tiered Cache.

Cache Reserve Analytics

Cache Reserve Analytics provides insights regarding your Cache Reserve usage. It allows you to check what content is stored in Cache Reserve, how often it is being accessed, how long it has been there and how much egress from your origin it is saving you.

In the Overview section, under Cache Reserve, you have access to the following metrics:

  • Egress savings (bandwidth) - is an estimation based on response bytes served from Cache Reserve that did not need to be served from your origin server. These are represented as cache hits.
  • Requests served by Cache Reserve - is the number of requests served by Cache Reserve (total).
  • Data storage summary - is based on a representative sample of requests. Refer to Sampling for more details about how Cloudflare samples data.
    • Current data stored - is the data stored (currently) over time.
    • Aggregate storage usage - is the total of storage used for the selected timestamp.
  • Operations - Class A (writes) and Class B (reads) operations over time.

Cache Reserve clear button

You can remove all data stored in Cache Reserve through the dashboard or via API. To clear your cache reserve:

  • Cache Reserve must have already been enabled for the zone.
  • Cache Reserve needs to be off.

Be aware that the deletion may take up to 24 hours to complete.

  1. In the Cloudflare dashboard, go to the Cache Reserve page.

  2. In Delete Cache Reserve Data, select Delete Storage.

To delete Cache Reserve data via API use the following example requests. For more information, refer to the API documentation.

Request 1: Get Cache Reserve status

{
	"result": {
		"editable": true,
		"id": "cache_reserve",
		"value": "off"
	},
	"success": true,
	"errors": [],
	"messages": []
}

If Cache Reserve is turned off, you can proceed to the Cache Reserve Clear operation.

Request 2: Start Cache Reserve Clear

{
	"result": {
		"id": "cache_reserve_clear",
		"start_ts": "2024-06-02T10:00:00.12345Z",
		"state": "In-progress"
	},
	"success": true,
	"errors": [],
	"messages": []
}