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

Developer Platform Developer Platform

Build và deploy apps trên Cloudflare. Build and deploy apps on Cloudflare.

Về trang lộ trình Track home

Phần 3: Chọn storage đúng Part 3: Pick the right storage · Bài 1/3 Lesson 1/3

KV cho config và cache nhẹ KV for config and light cache

Lưu feature flags, session token ngắn, rate limit counter. Không dùng KV cho giao dịch tài chính cần consistency cao. Store feature flags, short session tokens, rate limit counters. Avoid KV for financial transactions needing strong consistency.

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

  1. Tạo KV namespace: `wrangler kv namespace create APP_CONFIG`. Create KV namespace: `wrangler kv namespace create APP_CONFIG`.
  2. Binding trong wrangler.toml / Pages settings. Bind in wrangler.toml / Pages settings.
  3. Đọc/ghi từ Worker: `env.KV.put(key, value)`. Read/write from Worker: `env.KV.put(key, value)`.
  4. Dùng cho flags, cache config — không cho ledger tài chính. Use for flags, config cache — not financial ledgers.

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

KV eventually consistent, đọc cực nhanh tại edge — ideal cho read-heavy config. KV is eventually consistent with extremely fast edge reads — ideal for read-heavy config.

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

Dùng binding (KV, R2, D1…) trực tiếp trong Worker — không gọi REST API Cloudflare từ trong Worker (thêm latency, auth và phức tạp không cần thiết). Use bindings (KV, R2, D1, etc.) directly in Workers — do not call the Cloudflare REST API from within a Worker (adds latency, auth, and unnecessary complexity).

Nguồn: Source: Workers Best Practices Workers Best Practices

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.

Tutorial Tutorial Developer Platform Developer Platform

Sử dụng Workers KV directly từ Rust Use Workers KV directly from Rust

Tóm tắt thực hành: Sử dụng Workers KV directly từ Rust trên Cloudflare Workers. This tutorial will teach you how to read and write to KV directly from Rust using workers-rs. You will use Workers KV from Rust to build an app to store and retrieve cities.

This tutorial will teach you how to read and write to KV directly from Rust using workers-rs. You will use Workers KV from Rust to build an app to store and retrieve cities.

Tìm hiểu thêm Learn more
Tutorial Tutorial Application Services Application Services

3 – Configure HTTPS settings Configure HTTPS settings

Tóm tắt thực hành: Cấu hình HTTPS settings trên Terraform. This tutorial shows how to enable TLS 1.3, Automatic HTTPS Rewrites, and Strict SSL mode using the updated v5 provider.

This tutorial shows how to enable TLS 1.3, Automatic HTTPS Rewrites, and Strict SSL mode using the updated v5 provider.

Tìm hiểu thêm Learn more
Tutorial Tutorial Application Services Application Services

Cấu hình your mobile app or IoT device Configure your mobile app or IoT device

Tóm tắt thực hành: Cấu hình your mobile app or IoT device trên Cloudflare. This tutorial demonstrates how to configure your Internet-of-things (IoT) device and mobile application to use client certificates with API Shield.

This tutorial demonstrates how to configure your Internet-of-things (IoT) device and mobile application to use client certificates with API Shield.

Tìm hiểu thêm Learn more
Tutorial Tutorial Application Services Application Services

6 – Revert configuration Revert configuration

Tóm tắt thực hành: Revert configuration trên Terraform. Sometimes, you may have to roll back configuration changes. To revert your configuration, check out the desired branch and ask Terraform to move your Cloudflare settings back in t…

Sometimes, you may have to roll back configuration changes. To revert your configuration, check out the desired branch and ask Terraform to move your Cloudflare settings back in time.

Tìm hiểu thêm Learn more

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