angular / angular/angular-cli

Angular 19 SSR/hybrid rendering engine: cross-request cache

Đang mở
#30,305 4 bình luận 29 reaction 0 người được giao Xem trên GitHub
area: @angular/ssr feature feature: under consideration
Ngôn ngữ chính
TypeScript
Star
27k
Fork
11.8k
Merge trung bình
14 giờ 23 phút
Pull request đã merge (30 ngày)
162

Mô tả

### Command

run

### Description

It would be a useful optimization to cache some requests during SSR across requests to the SSR server. Some of the API requests have infrequently changing data. Pulling the response from cache would save a lot of network time, especially if the response is big.

Flow:
User 1 makes makes request to Angular SSR server -> SSR makes requests to API in order to gather data for rendering -> request gets cached -> user 1 receives an html response.
User 2 makes request to Angular SSR server -> SSR server would make API request in order to gather data, but instead pulls the response from the cache -> user 2 receives an html response.

One possible implementation would be to consider Cache-Control header and cache the response in the server for the time specified.

If this will not be considered - what would you say is the best approach in order to optimize these kind of API requests? Perhaps a wrapper around `global.fetch` in Node server (where Angular engine runs) which would monitor every API request and store in some local cache?

### Describe the solution you'd like

_No response_

### Describe alternatives you've considered

_No response_

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Không có tệp, bài kiểm thử hoặc điểm vào cụ thể nào được nêu. Hãy bắt đầu bằng cách lần theo đường dẫn yêu cầu Angular SSR/hybrid rendering trong máy chủ Node và xem xét cách global.fetch được sử dụng; xác định phạm vi bộ nhớ đệm, thời hạn hết hạn và hành vi của Cache-Control trước khi triển khai. Để được xem là hoàn tất, cần có thiết kế đã thống nhất, phần triển khai và độ bao phủ cho việc lưu vào bộ nhớ đệm giữa các yêu cầu.

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

Đánh giá

Công nghệ
angular, node.js, typescript
Lĩnh vực
backend, performance, web-dev
Loại issue
Tính năng
Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
25/100

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.