Repository navigation
Add storage.retention.keep_latest to keep the newest versions - #701
Conversation
Retention evicts every file that has not been served for the configured time, also the newest version of a package. keep_latest: N holds back the files of the N highest cached versions of each package from eviction by age. Versions are ordered by the ecosystem's version rules. It applies to cargo, golang, npm and pypi, where the cache stores a release under its version. Other ecosystems ignore it for now.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Retention evicts every file that hasn't been served for the configured time, including the newest version of a package. On a small cache with a short retention, that means the proxy drops the one version it will most likely be asked for next.
storage.retention.keep_latest: Nkeeps the files of the N highest cached versions of each package from eviction by age:vers.CompareWithScheme), not by fetch time. Prereleases count like any other version.storage.max_sizestill evicts as before.It applies to
cargo,golang,npmandpypi. An ecosystem opts in by settingCompareVersionsin itsretention.Spec; the others ignore the setting. On startup the proxy logs the covered ecosystems askeep_latest_covered. More ecosystems can follow one at a time. OCI needs a different approach, since its cache is keyed by digest; I'll send that as a separate PR.The sweep runs one indexed query per package that has an expired file, cached for the sweep.
Summary by CodeRabbit
storage.retention.keep_latestto retain a configurable number of the newest cached versions of each package from age-based eviction. Supported for Cargo, Go, npm, and PyPI; defaults to0(no versions protected).keep_latestvalues are rejected.