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 摘要。