diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-02-21 16:59:31 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-02-21 16:59:31 +0900 |
| commit | 261c3996805bcdfb7ff271290f3e3557dd15cea7 (patch) | |
| tree | cc701824713b792729bb29f40181698efc387104 /crates/mozart/src/commands/show.rs | |
| parent | 3535037592f149477c915a8b66da974eb59586db (diff) | |
| download | php-mozart-261c3996805bcdfb7ff271290f3e3557dd15cea7.tar.gz php-mozart-261c3996805bcdfb7ff271290f3e3557dd15cea7.tar.zst php-mozart-261c3996805bcdfb7ff271290f3e3557dd15cea7.zip | |
feat(cache): add filesystem-backed cache with TTL expiration and size-limited GC
Implement a cache module with CacheConfig and Cache structs supporting
read/write (string and binary), atomic writes via temp+rename, TTL-based
expiration, and size-limited garbage collection. Wire the repo cache into
packagist.rs and resolver.rs for API response caching, and the files
cache into downloader.rs for dist archive caching. Implement the
clear-cache command with full clear and --gc modes. All existing call
sites pass None for backward compatibility.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'crates/mozart/src/commands/show.rs')
| -rw-r--r-- | crates/mozart/src/commands/show.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/crates/mozart/src/commands/show.rs b/crates/mozart/src/commands/show.rs index ff157e0..ab013e3 100644 --- a/crates/mozart/src/commands/show.rs +++ b/crates/mozart/src/commands/show.rs @@ -468,7 +468,7 @@ fn fetch_latest_for_package(name: &str) -> anyhow::Result<LatestInfo> { use crate::package::Stability; use crate::version::find_best_candidate; - let versions = crate::packagist::fetch_package_versions(name)?; + let versions = crate::packagist::fetch_package_versions(name, None)?; let best = find_best_candidate(&versions, Stability::Stable) .ok_or_else(|| anyhow::anyhow!("No stable version found for {name}"))?; @@ -1447,7 +1447,7 @@ fn show_available(args: &ShowArgs, working_dir: &Path) -> anyhow::Result<()> { if is_platform_package(&pkg.name) { continue; } - match crate::packagist::fetch_package_versions(&pkg.name) { + match crate::packagist::fetch_package_versions(&pkg.name, None) { Ok(versions) => { let version_strings: Vec<String> = versions.iter().map(|v| v.version.clone()).collect(); @@ -1482,7 +1482,7 @@ fn show_available(args: &ShowArgs, working_dir: &Path) -> anyhow::Result<()> { } fn show_available_versions(pkg_name: &str, args: &ShowArgs) -> anyhow::Result<()> { - let versions = crate::packagist::fetch_package_versions(pkg_name)?; + let versions = crate::packagist::fetch_package_versions(pkg_name, None)?; if versions.is_empty() { println!("No versions found for {pkg_name}"); return Ok(()); @@ -1510,7 +1510,7 @@ fn show_available_versions(pkg_name: &str, args: &ShowArgs) -> anyhow::Result<() } fn show_available_versions_inline(pkg_name: &str) { - match crate::packagist::fetch_package_versions(pkg_name) { + match crate::packagist::fetch_package_versions(pkg_name, None) { Ok(versions) => { if versions.is_empty() { println!("{}: no versions found", crate::console::info(pkg_name)); |
