Add configurable size limit for persistent build cache with LRU eviction
- 主要言語
- TypeScript
- スター
- 27k
- フォーク
- 11.8k
- 平均マージ
- 14時間 23分
- マージ済み PR(30日)
- 162
説明
### Command
build, serve
### Description
The Angular CLI persistent disk cache (`.angular/cache`) grows without bounds. On large projects, a single checkout accumulates tens of gigabytes of cached build artifacts. In our case, a single checkout reached **29 GB**.
This was previously raised in #25116 and closed as not feasible with Webpack. Since Angular 17+, the build system uses esbuild, so the original constraint no longer applies.
### Describe the solution you'd like
Add a configurable size cap (e.g., `cli.cache.maxSize`) with LRU eviction when the limit is reached. This is a common pattern in build tooling — Turborepo, Gradle, and most browsers' HTTP caches all implement bounded persistent caches.
Example configuration:
```json
"cli": {
"cache": {
"enabled": true,
"maxSize": "2GB"
}
}
```
When the cache exceeds `maxSize`, the oldest/least-recently-used entries are evicted.
### Describe alternatives you've considered
- Periodically running `ng cache clean` or manually deleting `.angular/cache` — works but is a manual maintenance burden, especially for developers unaware the cache is growing.
コントリビューションガイド
調査の方向性
`build` コマンドと `serve` コマンドで使用される永続キャッシュから始め、`.angular/cache` 用の既存のエントリポイント `ng cache clean` と比較します。`cli.cache.maxSize` の設定方法と測定方法を定義し、設定された上限を超えた時点で最も最近使用されていないエントリが削除されることを確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- angular, typescript
- 領域
- build-system, cli
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 活発
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 45/100