Skip to content

Commit

Permalink
[Cache] Updates cache purge (#16945)
Browse files Browse the repository at this point in the history
* Updates cache purge

* Fixes typo

* Apply suggestions from code review

Co-authored-by: hyperlint-ai[bot] <154288675+hyperlint-ai[bot]@users.noreply.github.com>

* Apply suggestions from code review

* Update src/content/docs/cache/how-to/purge-cache/index.mdx

---------

Co-authored-by: hyperlint-ai[bot] <154288675+hyperlint-ai[bot]@users.noreply.github.com>
  • Loading branch information
angelampcosta and hyperlint-ai[bot] authored Sep 19, 2024
1 parent b7de234 commit c61660b
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ Class B operations are performed when data needs to be fetched from Cache Reserv

Asset purges are free operations.

Cache Reserve will also be purged along with edge cache when you send a purge by URL request.
Cache Reserve will be instantly purged along with edge cache when you send a purge by URL request.

Other purge methods, such as purge by tag, host, prefix, or purge everything will force an attempt to revalidate on the subsequent request for the Cache Reserve asset. Note that assets purged this way will still incur storage costs until their retention TTL expires.

Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/cache/how-to/purge-cache/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pcx_content_type: concept

import { DirectoryListing, FeatureTable } from "~/components"

Cloudflare offers different options to purge your content. Although single-file cache purging (purge by URL) is recommended, the following options are also available:
Cloudflare's Instant Purge ensures that updates to your content are reflected immediately. Multiple options are available for purging content, with single-file cache purging (purge by URL) being the recommended method. However, the following additional options are also available:

<DirectoryListing />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ sidebar:

---

Purging by hostname means that all assets at URLs with a host that matches one of the provided values will be purged from the cache.
Purging by hostname means that all assets at URLs with a host that matches one of the provided values will be instantly purged from the cache.

1. Log in to your [Cloudflare dashboard](https://dash.cloudflare.com/login), and select your account and domain.
2. Select **Caching** > **Configuration**.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ sidebar:

---

With purge by single-file, cached resources are immediately removed from the stored assets in your Content Delivery Network (CDN) across all data centers. New requests for the purged asset receive the latest version from your origin web server and add it back to your CDN cache within the specific Cloudflare data center that served the request.
With purge by single-file, cached resources are instantly removed from the stored assets in your Content Delivery Network (CDN) across all data centers. New requests for the purged asset receive the latest version from your origin web server and add it back to your CDN cache within the specific Cloudflare data center that served the request.

The single-file purge rate limit for the Free subscription is 1,000 URLs/minute. The rate limit is subject to change. For Zones on Free/Pro/Business plan, you may purge up to 30 URLs in one API call. For Zones on Enterprise plan, you may purge up to 500 URLs in one API call.

Expand Down
4 changes: 2 additions & 2 deletions src/content/docs/cache/how-to/purge-cache/purge-by-tags.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ sidebar:

---

Cache-tag purging makes multi-file purging easier because you can bulk purge by adding cache-tags to your assets, such as webpages, image files, and more. Note that Tag, Hostname and Prefix purges are only available for Enterprise customers.
Cache-tag purging makes multi-file purging easier because you can instantly bulk purge by adding cache-tags to your assets, such as webpages, image files, and more. Note that Tag, Hostname and Prefix purges are only available for Enterprise customers.

## General workflow for cache-tags

1. Add tags to the `Cache-Tag` HTTP response header from your origin web server for your web content, such as pages, static assets, etc.
2. [Ensure your web traffic is proxied](/dns/manage-dns-records/reference/proxied-dns-records/) through Cloudflare.
3. Cloudflare associates the tags in the `Cache-Tag` HTTP header with the content being cached.
4. Use specific cache-tags to purge your Cloudflare CDN cache of all content containing that cache-tag from your dashboard or [using our API](/api/operations/zone-purge).
4. Use specific cache-tags to instantly purge your Cloudflare CDN cache of all content containing that cache-tag from your dashboard or [using our API](/api/operations/zone-purge).
5. Cloudflare forces a [cache MISS](/cache/concepts/cache-responses/#miss) on content with the purged cache-tag.

:::caution[Warning]
Expand Down
10 changes: 5 additions & 5 deletions src/content/docs/cache/how-to/purge-cache/purge-cache-key.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ sidebar:

---

Purge resources that use Cache Keys via the [Cloudflare API](/api/operations/zone-purge). If you use [Cloudflares Purge by URL](/api/operations/zone-purge#purge-cached-content-by-url), include the headers and query strings that are in your custom Cache Key.
Instantly purge resources that use Cache Keys via the [Cloudflare API](/api/operations/zone-purge). If you use [Cloudflare's Purge by URL](/api/operations/zone-purge#purge-cached-content-by-url), include the headers and query strings that are in your custom Cache Key.

Currently, it is not possible to purge a URL stored through Cache API that uses a custom cache key set by a Worker. Instead, use a [custom key created by Cache Rules](/cache/how-to/cache-rules/settings/#cache-key). Alternatively, purge your assets using purge everything, purge by tag, purge by host or purge by prefix.

To purge `device_type`, `geo`, or `lang` use `CF-Device-Type`, `CF-IPCountry` or `accept-language`, respectively. [Purge by Tag / Host](/api/operations/zone-purge#purge-cached-content-by-tag-host-or-prefix) and [Purge Everything](/api/operations/zone-purge#purge-all-cached-content) are not impacted by the use of custom Cache Keys.
To instantly purge by `device_type`, `geo`, or `lang` use `CF-Device-Type`, `CF-IPCountry` or `accept-language`, respectively. [Purge by Tag / Host](/api/operations/zone-purge#purge-cached-content-by-tag-host-or-prefix) and [Purge Everything](/api/operations/zone-purge#purge-all-cached-content) are not impacted by the use of custom Cache Keys.

## Purge by device type

For a Cache Key based on device type, purge the asset by passing the `CF-Device-Type` header with the API purge request (valid headers include mobile, desktop, and tablet).

Refer to the example API request below to purge all mobile assets on the root webpage.
Refer to the example API request below to instantly purge all mobile assets on the root webpage.

```bash
curl "https://api.cloudflare.com/client/v4/zones/{zone_id}/purge_cache" \
Expand All @@ -28,7 +28,7 @@ curl "https://api.cloudflare.com/client/v4/zones/{zone_id}/purge_cache" \

## Purge by geo

Purge resources for a location-based Cache Key by specifying the two-letter country code. Spain is used in the example below.
Instantly purge resources for a location-based Cache Key by specifying the two-letter country code. Spain is used in the example below.

```bash
curl "https://api.cloudflare.com/client/v4/zones/{zone_id}/purge_cache" \
Expand All @@ -40,7 +40,7 @@ curl "https://api.cloudflare.com/client/v4/zones/{zone_id}/purge_cache" \

## Purge by language

For a Cache Key based on language, purge the asset by passing the `accept-language` header. Refer to the example API request below to purge all assets in Chinese (PRC).
For a Cache Key based on language, purge the asset by passing the `accept-language` header. Refer to the example API request below to instantly purge all assets in Chinese (PRC).

```bash
curl "https://api.cloudflare.com/client/v4/zones/{zone_id}/purge_cache" \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ sidebar:

To maintain optimal site performance, Cloudflare strongly recommends using single-file (by URL) purging instead of a complete cache purge.

Purging everything immediately clears all resources from your CDN cache in all Cloudflare data centers. Each new request for a purged resource returns to your origin server to validate the resource. If Cloudflare cannot validate the resource, Cloudflare fetches the latest version from the origin server and replaces the cached version. When a site with heavy traffic contains a lot of assets, requests to your origin server can increase substantially and result in slow site performance.
Purging everything instantly clears all resources from your CDN cache in all Cloudflare data centers. Each new request for a purged resource returns to your origin server to validate the resource. If Cloudflare cannot validate the resource, Cloudflare fetches the latest version from the origin server and replaces the cached version. When a site with heavy traffic contains a lot of assets, requests to your origin server can increase substantially and result in slow site performance.

1. Log in to your [Cloudflare dashboard](https://dash.cloudflare.com/login), and select your account and domain.
2. Select **Caching** > **Configuration**.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ sidebar:

---

Purging varied images purges all content variants for that URL. This behavior occurs so that if an image changes, you can easily update the cache with a single purge request instead of trying to determine the potential number of out-of-date variants. The behavior is true regardless of purge type used, such as single file, tag, or hostname.
Purging varied images instantly purges all content variants for that URL. This behavior occurs so that if an image changes, you can easily update the cache with a single purge request instead of trying to determine the potential number of out-of-date variants. The behavior is true regardless of purge type used, such as single file, tag, or hostname.
4 changes: 2 additions & 2 deletions src/content/docs/cache/how-to/purge-cache/purge_by_prefix.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ sidebar:

---

Enterprise customers can purge their cache by URL prefix or path separators in their URL. For an example URL like `https://www.example.com/foo/bar/baz/qux.jpg`, valid purge requests include:
Enterprise customers can instantly purge their cache by URL prefix or path separators in their URL. For an example URL like `https://www.example.com/foo/bar/baz/qux.jpg`, valid purge requests include:

* `www.example.com`
* `www.example.com/foo`
Expand Down Expand Up @@ -129,4 +129,4 @@ Take the following website as an example: `https://cloudflare.com/انشاء-م
</tbody>
</table>

As shown above, with URL normalization **ON**, visitors to the two URLs, `https://cloudflare.com/%D8%A7%D9%86%D8%B4%D8%A7%D8%A1-%D9%85%D9%88%D9%82%D8%B9-%D8%A7%D9%84%D9%83%D8%AA%D8%B1%D9%88%D9%86%D9%8A/img_1.jpg` and `https://cloudflare.com/انشاء-موقع-الكتروني/img_1.jpg`, will be served the same cached asset. Purging `https://cloudflare.com/%D8%A7%D9%86%D8%B4%D8%A7%D8%A1-%D9%85%D9%88%D9%82%D8%B9-%D8%A7%D9%84%D9%83%D8%AA%D8%B1%D9%88%D9%86%D9%8A/img_1.jpg` will purge that asset for both visitors.
As shown above, with URL normalization **ON**, visitors to the two URLs, `https://cloudflare.com/%D8%A7%D9%86%D8%B4%D8%A7%D8%A1-%D9%85%D9%88%D9%82%D8%B9-%D8%A7%D9%84%D9%83%D8%AA%D8%B1%D9%88%D9%86%D9%8A/img_1.jpg` and `https://cloudflare.com/انشاء-موقع-الكتروني/img_1.jpg`, will be served the same cached asset. Purging `https://cloudflare.com/%D8%A7%D9%86%D8%B4%D8%A7%D8%A1-%D9%85%D9%88%D9%82%D8%B9-%D8%A7%D9%84%D9%83%D8%AA%D8%B1%D9%88%D9%86%D9%8A/img_1.jpg` will instantly purge that asset for both visitors.
2 changes: 1 addition & 1 deletion src/content/docs/cache/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Use Cloudflare's persistent storage to increase cache times.

<Feature header="Purge" href="/cache/how-to/purge-cache/">

Clear cached files to force Cloudflare to fetch a fresh version of those files from your web server. You can purge files selectively or all at once.
Instantly purge cached files to force Cloudflare to fetch fresh versions from your web server files. You can purge specific files or all at once.


</Feature>
Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/cache/reference/development-mode.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ To bypass cache for longer than three hours, use bypass cache in [Cache Rules](/

## Enable Development Mode

Development Mode temporarily bypasses Cloudflares cache and does not purge cached files. To purge your Cloudflare cache, refer to [purge cache](/cache/how-to/purge-cache/).
Development Mode temporarily bypasses Cloudflare's cache and does not purge cached files. To instantly purge your Cloudflare cache, refer to [purge cache](/cache/how-to/purge-cache/).

1. Log in to your Cloudflare account.
2. Select your domain.
Expand Down

0 comments on commit c61660b

Please sign in to comment.