Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Document the scoped HTTP cache purge body and http_cache.warm_after_flush (api-components-bundle #484)

Đã đóng Phù hợp với người mới
#256 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
78/100
Loại issue
Tài liệu
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
yaml
Lĩnh vực
documentation

Hướng nghiên cứu

Bắt đầu trong content/4.api/ và tìm các trang về việc xóa bộ nhớ đệm HTTP và cấu hình bundle. Ghi lại phần thân yêu cầu dùng để xóa theo phạm vi, các lỗi xác thực và mã trạng thái, sau đó thêm cài đặt http_cache.warm_after_flush, định tuyến Messenger và hành vi được mô tả trong issue. Hoàn tất khi tài liệu API giải thích cả hai tính năng, bao gồm việc chỉ yêu cầu không có phần thân mới xóa toàn bộ bộ nhớ đệm và việc xóa toàn bộ khiến các trang ở trạng thái lạnh.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

From components-web-app/api-components-bundle#484, implemented in components-web-app/api-components-bundle#487.

Please document the following in the API docs (content/4.api/):

Scoped purge: POST /_/http_cache/purge

  • ROLE_ADMIN. It is the HTTP version of silverback:api-components:purge-http-cache --path/--tag.
  • A body {"paths": ["/about-us"], "tags": ["cwa-html"]} (either key or both) purges only those tags. Each path becomes the tag a write to the route at that path purges (the /_api import prefix is included), and the page is not looked up. It never flushes. Success is 204 with no body.
  • Only a request with no body at all flushes the whole cache. {}, null, [], malformed JSON, unknown keys, an empty or non-list paths/tags, a path not starting with /, or a tag that is empty or has whitespace or a comma are all a 422, with propertyPath paths, tags, paths[i] or tags[i].
  • 501 when no purger is configured (scoped) or the purger cannot flush (full); 502 when the purge fails.
  • Present the full flush as a last resort: it makes every page render cold at once. A write already purges its own tags.

http_cache.warm_after_flush (off by default)

silverback_api_components:
  http_cache:
    warm_after_flush:
      enabled: true
      base_url: 'http://localhost'   # the HTTP cache in front of the API, as warm-http-cache --base-url
      max_time: 60                   # seconds, for each encoding
      concurrency: 2
      timeout: 30
      limit: ~                       # most routes, shortest first; null = all until max_time
  • After a successful full flush (the endpoint with no body, purge-http-cache with no options, every fixture load's flush), the bundle dispatches two Silverback\ApiComponentsBundle\Message\WarmHttpCacheMessages on messenger.default_bus: one with Accept-Encoding: gzip (SSR) and one with br (browsers and CDN). Each runs the warm-http-cache logic over the public routes, shortest first, until max_time.
  • Route the message to an async transport and run a worker. Without async routing, the warm runs inside the request or command that flushed and holds a php worker. With no Messenger bus at all, nothing is warmed and a warning is logged.
  • A failed dispatch is logged at error and never fails the flush. The setting changes no response.
framework:
  messenger:
    routing:
      Silverback\ApiComponentsBundle\Message\WarmHttpCacheMessage: async
Ngôn ngữ chính
TypeScript
Star
0
Fork
0
Merge trung bình
1 giờ 20 phút
Pull request đã merge (30 ngày)
1

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của components-web-app/docs

Tất cả issue của components-web-app/docs

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.