Add configurable size limit for persistent build cache with LRU eviction
- 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
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.
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu với bộ nhớ đệm persistent được các lệnh `build` và `serve` sử dụng, rồi so sánh nó với entry point `ng cache clean` hiện có cho `.angular/cache`. Xác định cách cấu hình và đo `cli.cache.maxSize`, sau đó xác minh rằng các mục ít được sử dụng gần đây nhất sẽ bị loại bỏ khi vượt quá giới hạn đã cấu hình.
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, typescript
- Lĩnh vực
- build-system, cli
- 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
- Sôi nổi
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 45/100