Lộ trình đang học Current learning path

Application Services Application Services

Bảo vệ và tăng tốc website, application và API. Protect and accelerate websites, applications, and APIs.

Về trang lộ trình Track home

Phần 4: Content delivery & tăng tốc website Part 4: Content delivery & website speed · Bài 2/4 Lesson 2/4

Cache Rules & purge Cache Rules & purge

Bypass /admin, /checkout; TTL cho /assets/*; purge sau mỗi release frontend. Bypass /admin, /checkout; TTL for /assets/*; purge after each frontend release.

Các bước thực hiện Step-by-step

  1. Tạo Cache Rule: Bypass cho path dynamic. Create Cache Rule: Bypass for dynamic paths.
  2. Rule cache Everything hoặc Edge TTL cho /assets/*. Cache Everything or Edge TTL rule for /assets/*.
  3. Sau mỗi deploy frontend: Caching → Purge → Purge by URL hoặc tag. After each frontend deploy: Caching → Purge → by URL or tag.
  4. Document quy trình purge cho team release. Document purge process for the release team.

Giải thích chi tiết Detailed explanation

Purge sai lúc có thể spike origin — purge đúng URL/tag giữ cache hiệu quả sau release. Bad purge timing can spike origin load — targeted URL/tag purge keeps cache effective after releases.

Lưu ý (best practices) Note (best practices)

Dùng Cache Rules để mở rộng cache cho HTML hoặc path cụ thể. Với cache Miss, cân nhắc Tiered Cache hoặc custom cache key (ví dụ bỏ qua query string). Use Cache Rules to extend caching to HTML or specific paths. For cache Misses, enable Tiered Cache or create a custom cache key (e.g. ignore query strings).

Nguồn: Source: Cache performance Cache performance

Ví dụ triển khai (Cloudflare Resources) Deployment examples (Cloudflare Resources)

Ví dụ chính thức từ Cloudflare Resources — gợi ý theo chủ đề bài học trong lộ trình này. Official examples from Cloudflare Resources — matched to this lesson within this path.

Xem thêm ví dụ trong lộ trình → More examples in this path →

Tài liệu Cloudflare Developers Cloudflare Developer docs

Cloudflare API (tham khảo) Cloudflare API (reference)

Dùng khi tự động hóa bước này qua script hoặc Terraform — cần API token phù hợp. Use when automating this step via script or Terraform — requires an appropriate API token.

developers.cloudflare.com/api ↗

Sản phẩm liên quan Related products

Học xong hoặc muốn đổi hướng? Finished or want a different path?

Ba lộ trình độc lập — mỗi lộ trình chỉ gồm bài học và tài liệu trong phạm vi đó. Chọn lộ trình khác khi sẵn sàng, không cần học song song. Three independent paths — each includes only lessons and materials for that scope. Switch when you are ready; no need to study paths in parallel.

Chưa chắc — làm bài chọn lộ trình Not sure — use the path selector · So sánh cả ba lộ trình Compare all three paths