angular / angular/angular-cli

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

未關閉
#30,305 4 則留言 29 個 reaction 已指派 0 人 在 GitHub 檢視
area: @angular/ssr feature feature: under consideration
主要語言
TypeScript
星號
27k
分支
11.8k
平均合併
14 小時 23 分鐘
30 天內合併 PR
162

描述

### 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_

貢獻指南

開啟貢獻指南

研究方向

未指定任何檔案、測試或具體進入點。首先追蹤 Node 伺服器中的 Angular SSR/hybrid rendering 請求路徑,並檢視 global.fetch 的使用方式;在實作之前定義快取範圍、到期時間和 Cache-Control 行為。要視為完成,需要取得共識的設計、實作,以及對跨請求快取的涵蓋。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
angular, node.js, typescript
領域
backend, performance, web-dev
Issue 類型
功能
難度
5/5
預估耗時
一週以上
活躍度
停滯
描述清晰度
需要釐清
新手友好度
25/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。