diff --git a/CHANGELOG.md b/CHANGELOG.md index f8baa1ddf..f2edef018 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,14 @@ Versioning](https://semver.org/spec/v2.0.0.html). ## Unreleased +### Added + +- Local caches are now limited to the 10 most recently used entries per script, + instead of growing without bound. Set `WIREIT_CACHE_MAX_ENTRIES` to change the + limit, or to `infinity` for the previous behavior. Evicted entries are moved + to `.wireit/trash` and deleted at the end of the run, which is safe to + interrupt. See [#71](https://github.com/google/wireit/issues/71). + ## [0.14.13] - 2026-06-23 ### Added diff --git a/README.md b/README.md index 945ddecbe..19bcf757d 100644 --- a/README.md +++ b/README.md @@ -346,10 +346,25 @@ Local caching is enabled by default, unless the environment variable is detected. To force local caching, set `WIREIT_CACHE=local`. To disable local caching, set `WIREIT_CACHE=none`. -> ⚠️ Wireit does not currently limit the size of local caches. To free up this -> space, use `rm -rf .wireit/*/cache`. Automatic cache size limits will be added -> in an upcoming release, tracked at -> [wireit#71](https://github.com/google/wireit/issues/71). +Each script retains its 10 most recently used cache entries. Whenever a new +entry is written, any entries beyond that limit are evicted, least recently used +first. Because an entry is a full copy of the script's `output` files, this caps +a script's cache at roughly 10× the size of its output. + +To change the limit, set `WIREIT_CACHE_MAX_ENTRIES` to a positive integer, or to +`infinity` to retain every entry: + +```sh +export WIREIT_CACHE_MAX_ENTRIES=2 +``` + +Evicted entries are moved to `.wireit/trash` and deleted at the end of the run, +so that a script is never held up by a large delete. Interrupting that with +Ctrl-C is safe — whatever is left is deleted by the next run. + +Note the limit is applied per script, so a package with many cached scripts will +still use a multiple of this space. To free all of it at once, use +`rm -rf .wireit/*/cache .wireit/trash`. ### GitHub Actions caching @@ -868,18 +883,19 @@ The following syntaxes can be used in the `wireit.